Re: [HACKERS] New date/time formats - Mailing list pgsql-hackers

From Thomas G. Lockhart
Subject Re: [HACKERS] New date/time formats
Date
Msg-id 30fa9ab29bdfa02aa2735efb36807be6
Whole thread Raw
In response to [HACKERS] New date/time formats  ("Dorte Munk-Jakobsen" <munk@pt.lu>)
List pgsql-hackers
Dorte Munk-Jakobsen wrote:
> With all these changes currently being done on date/time would it be
> possible to add support for one or two new formats when selecting dates
> from the database?
> I would very much like to see formats such as 'J' for Julian date and 'W'
> for day of week, represented as a number or the text string representing
> the day.

Have you looked at date_part()? You can retrieve all of the fields
individually (as numbers) including day of week. This works for
"datetime" and possibly "abstime" (if abstime is not in v6.1 I have the
code ready to go into the v6.2 source tree after July 1).

I'll think about how to get Julian date directly; the code already will
give you seconds from 1970 by calling date_part('epoch', datetime)

            - Tom

------------------------------

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] [BUGS] DateStyle (fwd)
Next
From: hotz@jpl.nasa.gov (Henry B. Hotz)
Date:
Subject: Re: [HACKERS] [PATCHES] fixes for sparc-solaris (fwd)