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.
Author |
Topic |
dinesh1968
Starting Member
1 Post |
Posted - 2014-12-23 : 10:28:26
|
hi,i want to convert the datetime to the integer value as shown within the brackets.----2014-12-21 0:00:00 (1419091200000)thks.dineshjain_dinesh@hotmail.comdjain |
|
sz1
Aged Yak Warrior
555 Posts |
Posted - 2014-12-23 : 12:25:31
|
You need to do something like this: with getstring As ( select Convert(int,convert(varchar(max),getdate(),112)) as [DateKey], Convert(int,(DATEPART(hour, getdate()) * 10000) + (DATEPART(minute, getdate()) * 100) + (DATEPART(Second, getdate()))) AS [TimeKey] ) --Select cast( Datekey + ' ' + TimeKey as int) select concat(datekey, timekey) 'combo' From getstringWe are the creators of our own reality! |
|
|
|
|
|