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
 converting zulu format to datetime format

Author  Topic 

anjali5
Posting Yak Master

121 Posts

Posted - 2011-11-02 : 14:20:52
How can I convert navy zulu format to yyy.mm-dd HH:MM:SS



navy zulu format is 021731ZJUN06 to 2006-06-02 17:31:00


any help will be greatly appreciated.

zulu is a time zone. I think it GMT

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-02 : 14:39:36
see below


declare @zuludt varchar(100)

set @zuludt='021731ZJUN06'

select CONVERT(datetime,LEFT(@zuludt,2)+ ' ' + STUFF(right(@zuludt,5),4,0,' ') + ' ' +STUFF(SUBSTRING(@zuludt,3,4),3,0,':'),13) AS isodateval


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

anjali5
Posting Yak Master

121 Posts

Posted - 2011-11-02 : 15:03:16
Thanks Visakh!@!
thats what i needed.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2011-11-03 : 04:14:28
wc

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -