Thread: date format

date format

From
David Rysdam
Date:
I could swear (but I don't think I can prove at this point) that 8.0
beta3 returned timestamps with milliseconds, like this:

YYYY-MM-DD HH24:MI:SS.MS

But 8.1 isn't doing that.  I see functions to format the date, but that
would require me to change all my existing SQL to specifically ask for
the milliseconds.  There's also the "set datestyle" thing, but the
granularity doesn't exist to specify an exact format such as the above.
Is there a way to tell postgres *exactly* what I want the *default* date
output format to be?

Re: date format

From
David Rysdam
Date:
David Rysdam wrote:

> I could swear (but I don't think I can prove at this point) that 8.0
> beta3 returned timestamps with milliseconds, like this:
>
> YYYY-MM-DD HH24:MI:SS.MS
>
> But 8.1 isn't doing that.  I see functions to format the date, but
> that would require me to change all my existing SQL to specifically
> ask for the milliseconds.  There's also the "set datestyle" thing, but
> the granularity doesn't exist to specify an exact format such as the
> above.  Is there a way to tell postgres *exactly* what I want the
> *default* date output format to be?
>
> ---------------------------(end of broadcast)---------------------------
> TIP 4: Have you searched our list archives?
>
>               http://archives.postgresql.org
>
>
Nevermind, the documentation just seems to be unclear.  I do get .MS
back in ISO format (despite that not being shown as part of the ISO
format).  It's just that none of my dates have milliseconds on them,
which is simply a bug I'll have to find.

Re: date format

From
David Rysdam
Date:
David Rysdam wrote:

> David Rysdam wrote:
>
>> I could swear (but I don't think I can prove at this point) that 8.0
>> beta3 returned timestamps with milliseconds, like this:
>>
>> YYYY-MM-DD HH24:MI:SS.MS
>>
>> But 8.1 isn't doing that.  I see functions to format the date, but
>> that would require me to change all my existing SQL to specifically
>> ask for the milliseconds.  There's also the "set datestyle" thing,
>> but the granularity doesn't exist to specify an exact format such as
>> the above.  Is there a way to tell postgres *exactly* what I want the
>> *default* date output format to be?
>>
>> ---------------------------(end of broadcast)---------------------------
>> TIP 4: Have you searched our list archives?
>>
>>               http://archives.postgresql.org
>>
>>
> Nevermind, the documentation just seems to be unclear.  I do get .MS
> back in ISO format (despite that not being shown as part of the ISO
> format).  It's just that none of my dates have milliseconds on them,
> which is simply a bug I'll have to find.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: if posting/reading through Usenet, please send an appropriate
>       subscribe-nomail command to majordomo@postgresql.org so that your
>       message can get through to the mailing list cleanly
>
>
OK, sorry to flood on this, but there is still a problem.  If I have no
milliseconds, I'd like to get back ".000" at the end of the output.
Since MS are indeed part of the ISO format, why don't get I get zeros?
Alternatively, if MS aren't part of the ISO format, why do I get non-zeros?