Friday, February 10, 2012

Convert date and time to string?

Hi,

Can anyone tell me how to convert date and time to string.

I got one field inside my database which contain data like below:

4/16/2004 10:19:01 AM

if i wan to call out a record which have to refer to the data above

Select *
From table_A
where field_date= ???

what to fill in the ??

ThanxMan, you were so close! Use:Select *
FROM table_A
WHERE field_date = '4/16/2004 10:19:01 AM'-PatP|||Originally posted by Pat Phelan
Man, you were so close! Use:Select *
FROM table_A
WHERE field_date = '4/16/2004 10:19:01 AM'-PatP

hi there again....

I tired like what you hav told me but i cant get any output from the query statement lo.its like the record doesn't exist.

its like the format i keyed in is not the same.

Can u pls explain .
thanx|||My guess would be that you are missing the milliseconds. The value in the database probably has milliseconds, but your constant does not.

Databases are finicky about things like that! ;)

-PatP

No comments:

Post a Comment