473,473 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

DateTime format to ISO 8601 -- won't change???

Hi, I've read every post I could find but still no luck on why this
won't work for me. I have an aspx page (U.S. default, VB, .Net 1.1),
where I use the following two variables:

Dim varStartTime As DateTime = DateTime.Now.ToString("t")
Dim varStartDOM As DateTime = DateTime.Now.ToString("s")

The first gives me the time portion of date/time as expected. The second
just gives me date/time in U.S. format and what I need is the ISO 8601
format. I just need it for a variable (varStartDOM) added to an xml
string, not for all datetimes in the app to be in the ISO 8601 format
(not by my choice, of course).

Any help appreciated!!!

Thanks,

Kathy

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #1
2 5983
Check the following link for strings that you can use to
specify a Custom date formats.

http://msdn.microsoft.com/library/default.asp?
url=/library/en-
us/cpguide/html/cpconcustomdatetimeformatstrings.asp

What is the format of ISO 8601?

Suresh.

-----Original Message-----
Hi, I've read every post I could find but still no luck on why thiswon't work for me. I have an aspx page (U.S. default, VB, .Net 1.1),where I use the following two variables:

Dim varStartTime As DateTime = DateTime.Now.ToString("t")
Dim varStartDOM As DateTime = DateTime.Now.ToString("s")

The first gives me the time portion of date/time as expected. The secondjust gives me date/time in U.S. format and what I need is the ISO 8601format. I just need it for a variable (varStartDOM) added to an xmlstring, not for all datetimes in the app to be in the ISO 8601 format(not by my choice, of course).

Any help appreciated!!!

Thanks,

Kathy

*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!
.

Nov 18 '05 #2
Having not used this before, I finally realized I needed an Import
System.DateTime in my aspx.

Now, DateTime.Now.ToString("s") translates correctly into sortable ISO
format 'yyyy-MM-ddTHH:mm:ss'.

Hope this helps someone else some day!

Thanks,

Kathy

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

15
by: Simon Brooke | last post by:
I'm investigating a bug a customer has reported in our database abstraction layer, and it's making me very unhappy. Brief summary: I have a database abstraction layer which is intended to...
0
by: Gary Brewer | last post by:
Hello, DateTime.Parse works great with ISO 8601 but it does not parse all RFC 822 formats, for example, it will parse Mon, 02 Feb 2004 12:35:25 GMT but it won't parse Mon, 02 Feb 2004...
2
by: Samuel | last post by:
Hello, I am trying to convert a local time into UTC ISO8601, then parse it back into local time. I tried the following: ---------------------- #!/usr/bin/python import time import datetime...
14
by: ChrisM | last post by:
Could anyone please tell me the difference between these 2 lines: myDate = DateTime.Now; and myDate = DateTime.Parse(DateTime.Now.ToString("dd/MM/yyyy")); Seeing as later on in the...
3
by: asanford | last post by:
I want to create a web service that allows the caller to pass a DateTime to the web service (that is, create a web method such as void MyWebMethod(DateTime dt).) However, I want to be able to...
11
by: Rubic | last post by:
I was a little surprised to recently discover that datetime has no method to input a string value. PEP 321 appears does not convey much information, but a timbot post from a couple years ago...
2
by: BLUE | last post by:
I want to store and retrieve datetime in ISO 8601 format: '2007-06-02T16:12:08.123-04:34' or '2007-06-02T16:12:08.123Z' When I insert a datetime with SQL Server Management Studio and then I...
2
by: helveticus | last post by:
Is there a way to keep datetime expressions culture invariant? My app is culture dependent and contains a series of datetime settings that are saved in cookies. The cookie date strings raise...
3
by: raulbolanos | last post by:
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?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.