Re: [Erlangweb-users] Displaying dates
Brought to you by:
etcerlangweb,
paulgray
|
From: Graeme D. <gra...@gm...> - 2010-03-21 01:24:48
|
On 20 March 2010 16:24, alexander barakin <ale...@gm...> wrote:
> On Sat, Mar 20, 2010 at 11:25, Graeme Defty <gra...@gm...> wrote:
>> On 20 March 2010 15:07, alexander barakin <ale...@gm...> wrote:
>>> On Sat, Mar 20, 2010 at 06:37, Graeme Defty <gra...@gm...> wrote:
>>>> Hi,
>>>>
>>>> I am sure everyone else is displaying dates fine, so it must be me,
>>>> but I have tried all the combinations i can think of.
>>>>
>>>> The data in my database looks good (as io:format-ed after reading) but
>>>> displays as an integer.
>>>>
>>>> My _types record contains this:
>>>>
>>>> dob = {date,[{format, "YYYY-MM-DD"},
>>>> {description, "Date of Birth"}]}
>>>>
>>>> and my html looks thusly:
>>>>
>>>> <p>date of birth: <wpart:lookup key="player:dob" format="date" /></p>
>>>>
>>>> but the display is just a number :
>>>>
>>>> date of birth: 61661174400
>>>>
>>>> i.e. the date in seconds.
>>>
>>> because 61661174400 is in far future? (:
>>> $ date -d @61661174400
>>> Thu Dec 20 03:00:00 MSK 3923
>>>
>>> --
>>> wbr, alexander barakin aka sash-kan.
>>>
>>
>> I don't think so.
>>
>> 61661174400 is 1953-12-17 in seconds.
>>
>> 1953-12-17 is what i put in the database and what i see read out of it
>> again, as I mentioned.
>
> 1953 — date before unix epoch, which starts at 1970-01-01:
> $ date -d '1953-12-17' +'%s'
> -506228400
>
> --
> wbr, alexander barakin aka sash-kan.
>
Erlang does not store dates in Unix format, but in a tuple of
{YYYY,MM,DD}. Unix epoch is irelevant.
In any case, even non-erlang programs are capable of displaying dates
before 1970.
So how is it done in ErlangWeb?
|