Re: [SQL] Datetime conversion in WHERE clause

2004-09-09 Thread Josh Berkus
Philippe, > Is there a way to force the date conversion to fail sliently, and simply > return a null in case the parameter is not a valid date? You'd need to write a custom function, using an external language that allows you to test for valid date values. I prefer using PL/perlU with Date::M

Re: [SQL] Datetime

2004-08-03 Thread Michael Glaesemann
On Aug 4, 2004, at 7:55 AM, Tom Lane wrote: Sorry if I added to the confusion instead of dispelling it. Not at all. I had no idea how timestamps are stored internally, but I do now. I just knew it wasn't UNIX epoch or the same as the text representation displayed in results. Your explanation has

Re: [SQL] Datetime

2004-08-03 Thread Tom Lane
Michael Glaesemann <[EMAIL PROTECTED]> writes: > I don't quite understand how I am wrong in saying that PostgreSQL does > not use UNIX epoch timestamps internally, as you've clearly explained > it doesn't. We are talking at cross-purposes. I thought you were suggesting that PG doesn't use a sec

Re: [SQL] Datetime

2004-08-03 Thread Michael Glaesemann
On Aug 4, 2004, at 12:13 AM, Tom Lane wrote: Michael Glaesemann <[EMAIL PROTECTED]> writes: No. I'm just saying that PostgreSQL does not represent or store timestamps as epoch timestamps internally. You're wrong. It's not exactly Unix-like because we use a different epoch date (2000-1-1 not 1970-1-

Re: [SQL] Datetime

2004-08-03 Thread Tom Lane
Michael Glaesemann <[EMAIL PROTECTED]> writes: > No. I'm just saying that PostgreSQL does not represent or store > timestamps as epoch timestamps internally. You're wrong. It's not exactly Unix-like because we use a different epoch date (2000-1-1 not 1970-1-1) but the concept is just the same: w

Re: [SQL] Datetime

2004-08-03 Thread Michael Glaesemann
On Aug 3, 2004, at 8:50 PM, Achilleus Mantzios wrote: O kyrios Michael Glaesemann egrapse stis Aug 3, 2004 : I believe this is incorrect. I believe PostgreSQL uses its own Do you suggest postgresql has any other means of getting time except the time(2) syscall?? timestamp datatype internally (which

Re: [SQL] Datetime

2004-08-03 Thread Achilleus Mantzios
O kyrios Michael Glaesemann egrapse stis Aug 3, 2004 : > > On Aug 3, 2004, at 7:23 PM, Achilleus Mantzios wrote: > > > now() returns the current UNIX (your running UNIX right?) timestamp > > which > > in turn is > > measured in seconds,miliseconds since the epoch. > > i.e. 1970-01-01 00:00:00 >

Re: [SQL] Datetime

2004-08-03 Thread Michael Glaesemann
On Aug 3, 2004, at 7:23 PM, Achilleus Mantzios wrote: now() returns the current UNIX (your running UNIX right?) timestamp which in turn is measured in seconds,miliseconds since the epoch. i.e. 1970-01-01 00:00:00 I believe this is incorrect. I believe PostgreSQL uses its own timestamp datatype in

Re: [SQL] Datetime

2004-08-03 Thread Achilleus Mantzios
O kyrios Pedro B. egrapse stis Aug 3, 2004 : > Hello, > > I'm using a TIMESTAMP column with a now() default which (correctly i > assume) uses a '-mm-dd hh:mm:ss' format. Wrong!, timestamp does not use any human readable format to be stored. Its not like MS* tools where dates/times are actua

Re: [SQL] Datetime

2004-08-03 Thread Devrim GUNDUZ
Hi, On Tue, 3 Aug 2004, Pedro B. wrote: > I'm using a TIMESTAMP column with a now() default which (correctly i > assume) uses a '-mm-dd hh:mm:ss' format. > > Is it possible to make it something like '-mm-dd hh:mm:ss:cc' ? > (basically, a DATE and a TIME, but with 2 decimal cases on th

Re: [SQL] Datetime

2004-08-03 Thread Michael Glaesemann
On Aug 3, 2004, at 4:22 PM, Pedro B. wrote: Is it possible to make it something like '-mm-dd hh:mm:ss:cc' ? (basically, a DATE and a TIME, but with 2 decimal cases on the :cc and not .c as the TIME format. timestamp and timestamptz both take an optional precision parameter. What you want

Re: [SQL] Datetime problem

2004-06-14 Thread Tom Lane
"Eric Lemes" <[EMAIL PROTECTED]> writes: > - select to_timestamp('2004 10 10 00 00 00', ' MM DD HH MI SS') > the output is: > - 2004-10-09 23:00:00-03 What PG version is this, on what platform, and what's your current timezone setting? regards, tom lane --

Re: [SQL] Datetime problem

2004-06-14 Thread Achilleus Mantzios
O kyrios Eric Lemes egrapse stis Jun 14, 2004 : > Hello there, > > I'm with a little trouble with postgresql and date/time conversions: > > - select to_timestamp('2004 10 10 00 00 00', ' MM DD HH MI SS') > > the output is: > > - 2004-10-09 23:00:00-03 Just do select to_timestamp('2004 10

Re: [SQL] Datetime problem

2004-06-14 Thread Stef
Hello Eric, Are you looking for something like : select to_char(timestamp 'now',' MM DD HH MI SS'); or the values in your example below : select to_char(timestamp '20041010 00:00:00',' MM DD HH MI SS'); Eric Lemes mentioned : => Hello there, => => I'm with a little trouble with postgresq

Re: [SQL] Datetime Query

2001-02-16 Thread Jie Liang
Try: SELECT request_no FROM request where status_code ='C' and (completed_date::date between '01/01/2000'::date and '01/01/2001'::date) actually date('01/01/2000') does same thing as '01/01/2000'::date Jie LIANG St. Bernard Software Internet Products Inc. 10350 Science Center Drive Suite 10