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 datetime to hhmm

Author  Topic 

vini
Starting Member

11 Posts

Posted - 2006-11-24 : 04:05:54
I was wondering if it was possible to convert a datetime field lets say getdate() to hhmm.

Thanks in advance,
Vini

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-11-24 : 04:08:47
Yes. It is possible. But where do you want to show data? If you use front end application, you can use format function there

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

vini
Starting Member

11 Posts

Posted - 2006-11-24 : 04:17:04
I am making DTS packages and exporting to a text file,

Thx,
Vini
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-11-24 : 04:24:23
in sql server help file, read about convert function

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2006-11-24 : 04:25:19
SELECT REPLACE(CONVERT(varchar(5), GETDATE(), 108), ':', '')


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

vini
Starting Member

11 Posts

Posted - 2006-11-24 : 04:33:38
That worked
Thx a lot!
Go to Top of Page
   

- Advertisement -