Обсуждение: [HACKERS] New date/time formats

Поиск
Список
Период
Сортировка

[HACKERS] New date/time formats

От
"Dorte Munk-Jakobsen"
Дата:
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.

- --------
Dorte Munk-Jakobsen
munk@pt.lu

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

Re: [HACKERS] New date/time formats

От
"Thomas G. Lockhart"
Дата:
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

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