473,809 Members | 2,819 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Unexpected result using DateTime.ParseE xact

Hi,

I've the following line of code:

result = DateTime.ParseE xact("1999-12-01T23:59:59Z", "yyyy-MM-ddTHH:mm:ssZ",
CultureInfo.Inv ariantCulture);

where I get in result "result" "02.12.1999 00:59:59" instead of teh
expected "01.12.1999 23:59:59"
Anybody a idea ?

Thanx Peter

Nov 4 '07
11 9845
Hi Stephany,

It is now 19:00 in the Netherlands which is as I wrote in CET and that is
one hour later then in England where it is 18:00.

(It is however earlier 12:00 here then in England, because CET is 1 hour
before GMT, that is probably your confusion, however I wrote nowhere that
CET is behind GMT/UTC/ZULU/Zero time/Military).

BBC 1 and 2 are standard television stations here and I can assure you that
I don't have to think when they are talking about the time and that is
forever because in the EU is the summertime (what is in the US timesaving
time) synchronized for every timetable.

Cor
Nov 5 '07 #11
Hi All,

thank you very much for all the answers (really a interesting thread and
helpful !!!).
Someone asked why to hell I didn't want to have the right result :-)

1) I have to support a application which stores the time informatin wrong
(ends with Zulu but local time is stored)
2) looking into the help for DateTime.Format Exact I could not find why the
function behaves as it does.

I asked the same question in the german NG and got an answer with many links
concerning this problem.
Maybe they are helpfule for you too. Here they are:

<http://msdn2.microsoft .com/en-us/library/91hfhz89.aspx>
<http://msdn2.microsoft .com/en-us/netframework/aa569606.aspx>
<http://msdn2.microsoft .com/en-us/library/ms973825.aspx>
<http://msdn2.microsoft .com/en-us/library/2h3syy57.aspx>
<http://msdn2.microsoft .com/en-us/library/5hh873ya.aspx>
<http://msdn2.microsoft .com/en-us/library/8kb3ddd4.aspx>

<http://blogs.msdn.com/bclteam/archive/2004/12/20/327702.aspx>

<URL:http://blogs.msdn.com/bclteam/archiv...ony-moore.aspx
<http://blogs.msdn.com/bclteam/archive/2007/06/18/a-brief-history-of-datetime-anthony-moore.aspx>>
<URL:http://blogs.msdn.com/bclteam/archiv...ony-moore.aspx
<http://blogs.msdn.com/bclteam/archive/2007/07/12/a-brief-history-of-datetime-follow-up-anthony-moore.aspx>>

Peter
"Cor Ligthert[MVP]" <no************ @planet.nlschri eb im Newsbeitrag
news:6D******** *************** ***********@mic rosoft.com...
Hi Stephany,

It is now 19:00 in the Netherlands which is as I wrote in CET and that is
one hour later then in England where it is 18:00.

(It is however earlier 12:00 here then in England, because CET is 1 hour
before GMT, that is probably your confusion, however I wrote nowhere that
CET is behind GMT/UTC/ZULU/Zero time/Military).

BBC 1 and 2 are standard television stations here and I can assure you
that I don't have to think when they are talking about the time and that
is forever because in the EU is the summertime (what is in the US
timesaving time) synchronized for every timetable.

Cor

Nov 5 '07 #12

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

Similar topics

3
3962
by: Mike Pemberton | last post by:
I'm sure there's a good explanation for this effect, but I get rather a strange output from this little test: #include <iostream> #include <list> int main() { std::list<int> int_list;
0
1605
by: Fred Strauss | last post by:
I am having an odd problem using the DateTime.ParseExact() method that I'm hoping someone can help me with. I have XML files that use 2 different date formats internally. I am trying to use the same call to ParseExact to parse either format. I am using C# to call the following form of ParseExact: public static DateTime ParseExact(string, string, IFormatProvider, DateTimeStyles);
3
7792
by: Dave P. | last post by:
I'm trying to parse a string into a DateTime object. I want to try using ParseExact to see if I can improve performance of a frequently-called method (i.e., please don't suggest using Parse()). My code looks like this: IFormatProvider fp = new System.Globalization.CultureInfo ("en-US"); DateTime dt = DateTime.ParseExact("Mar 9, 2005", "MMM d, yyyy", fp);
5
1749
by: ramon.smits | last post by:
I'm trying to get the following date/time string formatted. But I don't succeed. I get an exception saying the date/time string is invalid. string input = "8/09/05 9:27a"; string format = "M/dd/yy h:mmt"; DateTime.ParseExact(input, format, null); What am I doing wrong here? The following parse works ok.
11
7258
by: Cor Ligthert | last post by:
Hello everybody, Jay and Herfried are telling me every time when I use CDate that using the datetime.parseexact is always the best way to do String to datetime conversions. They don't tell why only that I have to listen to them because they know it better. They told also that in a business situation it is better to use datetime.parseexact for changing cultures and not to use the globalization setting. I did not give them this sample,...
1
4476
by: Pablo | last post by:
Hello, I have big problem with method ParseExact from class DateTime. Here is code sample: '----------------------------------------------------------------------------------------------------------------------------------------- Module Module1 Sub Main() Console.WriteLine("Start...") Try
1
15037
by: Erica | last post by:
Hi. I have a string: "11/24/2006 23:59" named StartDateTime I need the string to be converted into a DateTime object in the following format: 2006-11-24 11:59 PM I tried the following: DateTime.ParseExact(StartDateTime,"yyyy-MM-dd HH:mm tt*", System.Globalization.CultureInfo.CurrentCulture)
3
21278
by: Peter Duniho | last post by:
I'm sure there's a good explanation for this, but I can't figure it out. I tried using DateTime.Parse() with a custom DateTimeFormatInfo instance, in which I'd replaced the DateTimeFormatInfo.FullDateTimePattern property with my custom format string: DateTimeFormatInfo dtfi = (DateTimeFormatInfo)DateTimeFormatInfo.InvariantCulture.Clone(); dtfi.FullDateTimePattern = "dd/MMM/yyyy:HH:mm:ss zzz";
5
5613
by: John B | last post by:
Hi all, Any idea why this code results in a FormatException? DateTime.ParseExact("40708", "dMMyy", CultureInfo.CurrentCulture) If I use "040708" with the same format string it works and it parses all double digit days fine. TIA JB
0
10633
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10376
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10114
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9198
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7651
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6880
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5548
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5686
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
3011
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.