Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 136,067 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 1,583 people online right now. Registration is fast and FREE... Join Now!




DateTime Format help

 
Reply to this topicStart new topic

DateTime Format help, $@*&$^#*

atrum_tutela
23 Apr, 2008 - 06:12 AM
Post #1

New D.I.C Head
*

Joined: 21 Feb, 2008
Posts: 4



Thanked: 1 times
My Contributions
I need to put a time stamp in the header of my file in this format: yyyy-MM-ddT:HH:mm:ssZ
I'm just using the DateTime.ToString method like so:
CODE
string CreatedTime = utcCreatedTime.ToString("u");

when I use the "u" format string I get the date without the "T" in the middle and if I use "s" I get the date without the "Z" on the end.. I can't seem to get there from here... I'm tempted to just concatenate the damn Z on the end and call it a day... crazy.gif

any ideas?
User is offlineProfile CardPM
+Quote Post

zakary
RE: DateTime Format Help
23 Apr, 2008 - 06:33 AM
Post #2

D.I.C Regular
Group Icon

Joined: 15 Feb, 2005
Posts: 404



Thanked: 6 times
Dream Kudos: 175
My Contributions
csharp

string CreatedTime = DateTime.Parse(utcCreatedTime).ToString("yyyy/MM/dd HH:mm:ss")


and if you want Local time

csharp

string CreatedTime = DateTime.Parse(utcCreatedTime).ToLocalTime().ToString("yyyy/MM/dd HH:mm:ss")


This post has been edited by zakary: 23 Apr, 2008 - 06:33 AM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/1/08 06:46PM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month