467,077 Members | 1,067 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,077 developers. It's quick & easy.

Time format

Did anybody see this bug? I tried to reproduce that using 12-hour and
24-hour system settings. Anyway it still causes a problem in VS2003. When I
convert DateTime to a string using default ToString(), like
DateTime.Now.ToString() C# returns me this string instead of a correct one:
"19:25:35 PM". That's nonsense, but when I try to use
DateTime.Parse(ThisString) it causes a fatal error, because this string
doesn't look like as a time string. What's the matter?

Thanks,
Dmitri

Nov 16 '05 #1
  • viewed: 7248
Share:
3 Replies
By the way, I can format this time manually in most cases, maybe excluding a
few cases like this:

dtCalDate = DateTime.Parse(Request["CalDate"]);

Thanks,
Dmitri

"Just D" <no@spam.please>
Did anybody see this bug? I tried to reproduce that using 12-hour and
24-hour system settings. Anyway it still causes a problem in VS2003. When
I convert DateTime to a string using default ToString(), like
DateTime.Now.ToString() C# returns me this string instead of a correct
one: "19:25:35 PM". That's nonsense, but when I try to use
DateTime.Parse(ThisString) it causes a fatal error, because this string
doesn't look like as a time string. What's the matter?


Nov 16 '05 #2
03/06/2004 1:22:58 PM (using 12 hour clock)
03/06/2004 13:26:10 PM (using 24 hour clock)
I get the same problem :(

However, when I go to regional settings and change the time format from
HH:mm:ss tt to HH:mm:ss (remove tt) I get the correct result.
03/06/2004 13:29:00
DateTime.ToString is therefore right because it is supposed to return a
datetime based on the system short datetime format.
Check your regional settings.

JB

"Just D" <no@spam.please> wrote in message
news:1Rvvc.13259$lL1.3892@fed1read03...
By the way, I can format this time manually in most cases, maybe excluding a few cases like this:

dtCalDate = DateTime.Parse(Request["CalDate"]);

Thanks,
Dmitri

"Just D" <no@spam.please>
Did anybody see this bug? I tried to reproduce that using 12-hour and
24-hour system settings. Anyway it still causes a problem in VS2003. When I convert DateTime to a string using default ToString(), like
DateTime.Now.ToString() C# returns me this string instead of a correct
one: "19:25:35 PM". That's nonsense, but when I try to use
DateTime.Parse(ThisString) it causes a fatal error, because this string
doesn't look like as a time string. What's the matter?

Nov 16 '05 #3
Hi John,

Yes, I was playing with the regional settings and noticed that sometimes it
doesn't help. That's very strange but fact. When I noticed this problem
first time I tried to correct these settings for my local system. I like to
work at night, and everything was looking good, until the time rolled over
12 hours when I was working afternoon.

I suspect that the problem is much deeper and we need to correct the
DateTime.Parse() method. I can try to correct this one replacing all calls
in my code with my method, but... as you understand, sometimes it can't be
solved. It should be solved at the lowest level instead.

Thanks,
Dmitri

"John Baro"
03/06/2004 1:22:58 PM (using 12 hour clock)
03/06/2004 13:26:10 PM (using 24 hour clock)
I get the same problem :(

However, when I go to regional settings and change the time format from
HH:mm:ss tt to HH:mm:ss (remove tt) I get the correct result.
03/06/2004 13:29:00
DateTime.ToString is therefore right because it is supposed to return a
datetime based on the system short datetime format.
Check your regional settings. "Just D" <no@spam.please> wrote in message
news:1Rvvc.13259$lL1.3892@fed1read03...
By the way, I can format this time manually in most cases, maybe
excluding

a
few cases like this:

DateTime.Parse(Request["CalDate"]);

Thanks,
Dmitri

"Just D" <no@spam.please>
> Did anybody see this bug? I tried to reproduce that using 12-hour and
> 24-hour system settings. Anyway it still causes a problem in VS2003. When > I convert DateTime to a string using default ToString(), like
> DateTime.Now.ToString() C# returns me this string instead of a correct
> one: "19:25:35 PM". That's nonsense, but when I try to use
> DateTime.Parse(ThisString) it causes a fatal error, because this string
> doesn't look like as a time string. What's the matter?



Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by Gord | last post: by
6 posts views Thread by Rene | last post: by
10 posts views Thread by scorpion53061 | last post: by
7 posts views Thread by Jerome | last post: by
18 posts views Thread by Dirk Hagemann | last post: by
2 posts views Thread by nospam@thankyou.com | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.