| Author |
Message |
Dave *nix forums Guru
Joined: 19 Feb 2005
Posts: 1725
|
Posted: Wed Feb 09, 2005 11:01 pm Post subject:
Re: Comparing DATE with TIMESTAMP fields possible ?
|
|
|
"George Dainis" <george.dainis@bluecorner.com> wrote in message
news:cue1up$k5b$01$1@news.t-online.com...
| Quote: | In my database table there is a datetime column which can obviously
contain a timestamp
(in the format YYYY-MM-DD HH:MM:SS.NNN).
Now I want to get all those records which have a date of lets say
2005-02-03 regardsless of
their time value.
Ok, I could do this by statement like
SELECT * FROM MYTAB WHERE MYDATE >= '2005-02-03 00:00:00.000' AND MYDATE
= '2005-02-03 23:59.59.999'
but this is rather inconvenient. I feel that there must be a shorter
version like
SELECT * FROM MYTAB WHERE MYDATE = '2005-02-03 **:**:**.***'
or a built-in fuction like:
SELECT * FROM MYTAB WHERE datepartonly(MYDATE) = '2005-02-03'
How does this work?
George
|
rtfm to_date |
|
| Back to top |
|
 |
Dave *nix forums Guru
Joined: 19 Feb 2005
Posts: 1725
|
Posted: Wed Feb 09, 2005 11:00 pm Post subject:
Re: Comparing DATE with TIMESTAMP fields possible ?
|
|
|
"George Dainis" <george.dainis@bluecorner.com> wrote in message
news:cue1up$k5b$01$1@news.t-online.com...
| Quote: | In my database table there is a datetime column which can obviously
contain a timestamp
(in the format YYYY-MM-DD HH:MM:SS.NNN).
Now I want to get all those records which have a date of lets say
2005-02-03 regardsless of
their time value.
Ok, I could do this by statement like
SELECT * FROM MYTAB WHERE MYDATE >= '2005-02-03 00:00:00.000' AND MYDATE
= '2005-02-03 23:59.59.999'
but this is rather inconvenient. I feel that there must be a shorter
version like
SELECT * FROM MYTAB WHERE MYDATE = '2005-02-03 **:**:**.***'
or a built-in fuction like:
SELECT * FROM MYTAB WHERE datepartonly(MYDATE) = '2005-02-03'
How does this work?
George
|
|
|
| Back to top |
|
 |
George Dainis *nix forums beginner
Joined: 09 Feb 2005
Posts: 10
|
Posted: Wed Feb 09, 2005 9:13 pm Post subject:
Comparing DATE with TIMESTAMP fields possible ?
|
|
|
In my database table there is a datetime column which can obviously contain a timestamp
(in the format YYYY-MM-DD HH:MM:SS.NNN).
Now I want to get all those records which have a date of lets say 2005-02-03 regardsless of
their time value.
Ok, I could do this by statement like
SELECT * FROM MYTAB WHERE MYDATE >= '2005-02-03 00:00:00.000' AND MYDATE <= '2005-02-03 23:59.59.999'
but this is rather inconvenient. I feel that there must be a shorter version like
SELECT * FROM MYTAB WHERE MYDATE = '2005-02-03 **:**:**.***'
or a built-in fuction like:
SELECT * FROM MYTAB WHERE datepartonly(MYDATE) = '2005-02-03'
How does this work?
George |
|
| Back to top |
|
 |
Google
|
|
| Back to top |
|
 |
|