|
-
June 12th, 2009, 04:49 AM
#1
Change DateTime.Now format to ISO 8601
Hello guys,
I get this time from DateTime.Now "6/12/2009 11:45:28 AM" and I need to convert it ISO 8601 which is the one that SQL accepts "2009-12-06 11:45:28".
What can I do?
-
June 12th, 2009, 05:11 AM
#2
Re: Change DateTime.Now format to ISO 8601
I found a way to do this
Code:
DateTime lastTime = DateTime.Now;
string x = lastTime.ToString("u").Replace("Z", "");
but I need to do this in 1 step because I send this time by parameters, i,e:
Code:
Insert(DateTime.Now);
And I would like to send the time through it
-
June 12th, 2009, 07:07 AM
#3
Re: Change DateTime.Now format to ISO 8601
-
June 12th, 2009, 10:56 AM
#4
Re: Change DateTime.Now format to ISO 8601
Code:
Insert(DateTime.Now.ToString("u").Replace("Z", ""));
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|