Zulu date and time format

Asim Nazir
Asim Nazir used Ask the Experts™

I have a DateTime stored in my DataBase. DateTime can be in UTC or GMT format.
What I want is to display it in zulu format.

What to do?

Thanks in anticipation.
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
try this

Code Example:

// This is the format with 'zzzzz' representing local time offset
const string format = "ddd MMM dd HH:mm:ss zzzzz yyyy";

// create a UTC time
const string expected = "Fri Dec 19 17:24:18 +0000 2008";
var time = new DateTime(2008, 12, 19, 17, 24, 18, 0, DateTimeKind.Utc);

// If you're using a debugger this will rightfully throw an exception
// with .NET 3.5 SP1 because 'z' is for local time only; however, the exception
// asks me to use the 'Z' specifier for UTC times, but it doesn't exist, so it
// just spits out 'Z' as a literal.
var actual = time.ToString(format, CultureInfo.InvariantCulture);

Assert.AreEqual(expected, actual);
Isn't Zulu just an abbreviation of Utc [1]? So convert it to Utc instead, you can use the TimeZoneInfo class and its ConvertTime method to convert to your specified TimeZone [2].

There is an example [3] at MSDN to enumerate all TimeZones available.

Good luck!

 [1]: http://geography.about.com/od/timeandtimezones/a/gmtutc.htm
 [2]: http://msdn.microsoft.com/en-us/library/bb382770.aspx
 [3]: http://msdn.microsoft.com/en-us/library/bb397781.aspx
Imran Javed ZiaConsultant Software Engineer - .NET Architect

According to my info Zulu is synonym of UTC and it is generally in and it will show current date and time as Tuesday 17 May 2011 13:46:53
string s = DateTime.Now.ToString("MMMM dd yyyy HH:mm:ss");

Asim NazirProject Manager


None of the solutions proposed by other experts worked for me. I posted my solution just for reference to others.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial