Online Documentation Server
 ПОИСК
ods.com.ua Web
 КАТЕГОРИИ
Home
Programming
Net technology
Unixes
Security
RFC, HOWTO
Web technology
Data bases
Other docs

 


 ПОДПИСКА

 О КОПИРАЙТАХ
Вся предоставленная на этом сервере информация собрана нами из разных источников. Если Вам кажется, что публикация каких-то документов нарушает чьи-либо авторские права, сообщите нам об этом.




Date/Time Functions

Date/Time Functions

The date/time functions provide a powerful set of tools for manipulating various date/time types.

Table 5-6. Date/Time Functions

FunctionReturnsDescriptionExample
abstime(timestamp)abstimeconvert to abstimeabstime(timestamp 'now')
age(timestamp)intervalpreserve months and yearsage(timestamp '1957-06-13')
age(timestamp,timestamp)intervalpreserve months and yearsage('now', timestamp '1957-06-13')
date_part(text,timestamp)float8portion of datedate_part('dow',timestamp 'now')
date_part(text,interval)float8portion of timedate_part('hour',interval '4 hrs 3 mins')
date_trunc(text,timestamp)timestamptruncate datedate_trunc('month',abstime 'now')
interval(reltime)intervalconvert to intervalinterval(reltime '4 hours')
isfinite(timestamp)boola finite time?isfinite(timestamp 'now')
isfinite(interval)boola finite time?isfinite(interval '4 hrs')
reltime(interval)reltimeconvert to reltimereltime(interval '4 hrs')
timestamp(date)timestampconvert to timestamptimestamp(date 'today')
timestamp(date,time)timestampconvert to timestamptimestamp(timestamp '1998-02-24',time '23:07');
to_char(timestamp,text)textconvert to stringto_char(timestamp '1998-02-24','DD');

For the date_part and date_trunc functions, arguments can be `year', `month', `day', `hour', `minute', and `second', as well as the more specialized quantities `decade', `century', `millennium', `millisecond', and `microsecond'. date_part allows `dow' to return day of week, 'week' to return the ISO-defined week of year, and `epoch' to return seconds since 1970 (for timestamp) or 'epoch' to return total elapsed seconds (for interval).



With any suggestions or questions please feel free to contact us