Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Convert Time Format In Database

Author  Topic 

edwinjoseph82
Starting Member

2 Posts

Posted - 2009-07-30 : 04:25:04
Hi
i need to change the Data for the datetime entry in the DB to 24 hour format. Right now its in 12 hour and that too without AM or PM to indicate the status for morning or evening.

for example: 7:00:00
it can be morning or evening 7.
This is how its stored in db and i need to convert it to 24 hour format.

is it possible?

senthil_nagore
Master Smack Fu Yak Hacker

1007 Posts

Posted - 2009-07-30 : 04:37:19
Without Knowing AM or PM we can't judge

If you know AM or PM then you use

select convert(varchar(10),cast('7:00:00'+' PM' as datetime),114)

Senthil.C
------------------------------------------------------
[Microsoft][ODBC SQL Server Driver]Operation canceled

http://senthilnagore.blogspot.com/
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2009-07-30 : 13:57:15
is there any other field which determines if its am or pm?
Go to Top of Page
   

- Advertisement -