[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Chicken-users] date, string formatting and locale
From: |
Hugo Arregui |
Subject: |
Re: [Chicken-users] date, string formatting and locale |
Date: |
Wed, 3 Nov 2010 11:32:37 -0300 |
On Wed, Nov 3, 2010 at 10:44 AM, Peter Bex <address@hidden> wrote:
>> 1) Using posix:
>>
>> (use posix)
>> (time->string (string->time "2" "%d"))
>> "Tue Jan 2 00:00:00 1900"
>>
>> but, my current locale es:
>>
>> (use locale)
>> (current-locale)
>> "es_AR.utf8"
>
> hmmm, I think time->string uses strftime(), so it depends on
> whether your OS supports this. Can you verify that? (ie, what's
> the output of date(2)?)
I think that is supported, I already wrote an C code to test it:
#include <stdio.h>
#include <time.h>
#include <locale.h>
int main()
{
time_t tiempo;
char cad[80];
char *old_locale;
struct tm *tmPtr;
setlocale(LC_ALL, "es_AR.utf8");
tiempo = time(NULL);
tmPtr = localtime(&tiempo);
strftime(cad, 80, "%H:%M.%S, %A de %B de %Y", tmPtr);
printf("%s\n", cad);
return 0;
}
"11:30.08, miércoles de noviembre de 2010"
(But sorry, I don't understand what is date(2), C, scheme, in the term?)
> I guess it uses the more Schemely syntax from SRFI-19. See the SRFI
> document for details: http://srfi.schemers.org/srfi-19/srfi-19.html
>
> (search for "string->date")
>
Great! it works!.
Thanks,
Hugo.
- [Chicken-users] date, string formatting and locale, Hugo Arregui, 2010/11/03
- Re: [Chicken-users] date, string formatting and locale, Peter Bex, 2010/11/03
- Re: [Chicken-users] date, string formatting and locale,
Hugo Arregui <=
- Re: [Chicken-users] date, string formatting and locale, Peter Bex, 2010/11/03
- Re: [Chicken-users] date, string formatting and locale, Hugo Arregui, 2010/11/03
- Re: [Chicken-users] date, string formatting and locale, Hugo Arregui, 2010/11/03
- Re: [Chicken-users] date, string formatting and locale, Kon Lovett, 2010/11/03
- Re: [Chicken-users] date, string formatting and locale, Hugo Arregui, 2010/11/03
Re: [Chicken-users] date, string formatting and locale, Thomas Chust, 2010/11/03