dbTalk Databases Forums  

Time travel

comp.databases.postgresql comp.databases.postgresql


Discuss Time travel in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Mladen Gogala
 
Posts: n/a

Default Time travel - 07-26-2010 , 01:31 PM






I was playing with the generate_series function which, as everybody knows,
can use dates, as of the version 8.4. What I didn't realize is that it
can also go backwards:

mgogala=# select generate_series('2011-01-01'::date,
'2010-07-01'::date,
'-1 month');
generate_series
------------------------
2011-01-01 00:00:00-05
2010-12-01 00:00:00-05
2010-11-01 00:00:00-04
2010-10-01 00:00:00-04
2010-09-01 00:00:00-04
2010-08-01 00:00:00-04
2010-07-01 00:00:00-04
(7 rows)

Time: 1.402 ms
mgogala=#


Now, that's kewl!

--
http://mgogala.byethost5.com

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.