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
 getdate()

Author  Topic 

shajimanjeri
Posting Yak Master

179 Posts

Posted - 2007-02-10 : 05:25:00

Hi,
when I used getdate() fuction, its giving the correct time in this format 10/02/2007 01:04:31 PM. But I need the time in 24 hour format. Means it should be like 10/02/2007 13:04:31.

How to get it. Please help me!!

shaji

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2007-02-10 : 06:15:10
That's formatting issue. Do it in your front end application. You can also it it T-SQL using convert() but it is not advicable.


KH

Go to Top of Page

sqllover
Constraint Violating Yak Guru

338 Posts

Posted - 2007-02-10 : 06:26:38
hi shajimanjeri, take ur solution from this format

Style Type
0 or 100 mon dd yyyy hh:miAM (or PM)
101 mm/dd/yy
102 yy.mm.dd
103 dd/mm/yy
104 dd.mm.yy
105 dd-mm-yy
106 dd mon yy
107 Mon dd, yy
108 hh:mm:ss
9 or 109 mon dd yyyy hh:mi:ss:mmmAM (or PM)
110 mm-dd-yy
111 yy/mm/dd
112 yymmdd
13 or 113 dd mon yyyy hh:mm:ss:mmm(24h)
114 hh:mi:ss:mmm(24h)
20 or 120 yyyy-mm-dd hh:mi:ss(24h)
21 or 121 yyyy-mm-dd hh:mi:ss.mmm(24h)
126 yyyy-mm-dd Thh:mm:ss.mmm(no spaces)
130 dd mon yyyy hh:mi:ss:mmmAM
131 dd/mm/yy hh:mi:ss:mmmAM
Go to Top of Page

sqllover
Constraint Violating Yak Guru

338 Posts

Posted - 2007-02-10 : 06:29:08
hi shajimanjeri as mr.khtan told it is not right work to do in database.do it in front end.

Go to Top of Page

shajimanjeri
Posting Yak Master

179 Posts

Posted - 2007-02-10 : 07:00:25
Hi khtan, Sqllover,

Thanx. Its working smoothly..

Shaji


quote:
Originally posted by sqllover

hi shajimanjeri as mr.khtan told it is not right work to do in database.do it in front end.



Go to Top of Page

shajimanjeri
Posting Yak Master

179 Posts

Posted - 2007-02-10 : 07:00:32
Hi khtan, Sqllover,

Thanx. Its working smoothly..

Shaji


quote:
Originally posted by sqllover

hi shajimanjeri as mr.khtan told it is not right work to do in database.do it in front end.



Go to Top of Page
   

- Advertisement -