I am unable to convert following date format in seconds (ss). Plz provide me query for the same.
Date Available :
2007-03-27 09:55:00.000select convert(datetime, '2007-03-27 09:55:00.000')
??|||select convert(datetime, '2007-03-27 09:55:00.000')
Yes, and the seconds are extracted by:
select datepart(ss, convert(datetime, '2007-03-27 09:55:00.000'))|||even the convet part of
select datepart(ss, convert(datetime, '2007-03-27 09:55:00.000'))
can be avoided and used as
select datepart(ss,'2007-03-27 09:55:00.000')|||but select datepart(ss,'2007-03-27 09:55:00.000') yields 0
i think perhaps milind wanted the answer to be 3383974800, which is that datetime converted in seconds in SQL Server
note that in unix timestamp format, the value would be 1175003700|||Perhaps, yes. Then the query he asked would be:
SELECT 3383974800|||no, not really, because you don't get that answer without doing a conversion
for example, what is the answer for '2006-09-09 09:37'?|||'2006-09-09 09:37' is not one of the available dates listed in the OP. ;)
Seriously, I think we need Milind to clarify what s/he wants.|||'2006-09-09 09:37' is not one of the available dates listed in the OP. ;)
good one :cool:
No comments:
Post a Comment