473,396 Members | 1,770 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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 18 '05 #1
3 1775
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 18 '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 18 '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 18 '05 #4

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

Similar topics

4
by: Gord | last post by:
Hello, VB6 accepts Date and Time values as 'Date'. I'm trying to verify entry into a database I'm creating by verifying that an appropriate Date or Time value has been entered. Using built-in...
3
by: T-Narg | last post by:
I would like to produce the following output based on my XML file: My Album (2005) Elapsed Time (hh:mm:ss): 00:07:00 Song 1: title1 Length (hh:mm:ss): 00:02:30 Song 2: title2 Length...
6
by: Kenneth | last post by:
Hello, I'm having some serious problems debugging a script that I'm trying to make work. I'm working on a form where a user can type in a time (in the format of HH:MM), and another script...
6
by: Rene | last post by:
I am currently displaying the time of day value using the "h:mm:ss tt" format (hr=hours, mm=minutes, ss=seconds tt=AM/PM). I was looking under the "Regional and Language Options" and it looks...
7
by: Edward Mitchell | last post by:
I have a number of DateTimePicker controls, some set to dates, some set to a format of Time. The controls are all embedded in dialogs. I created the controls by dragging the DateTime picker from...
10
by: scorpion53061 | last post by:
What I thought would be pretty easy has turned out not to be. I have three variables. Actiontime is formatted as 08/11/2004 11:03PM Actiontime JobStreamStart (11:00:00PM) JobStreamEnd...
15
by: Khurram | last post by:
I have a problem while inserting time value in the datetime Field. I want to Insert only time value in this format (08:15:39) into the SQL Date time Field. I tried to many ways, I can extract...
7
by: Jerome | last post by:
Hallo, I know a lot has already been told about date/time fields in a database but still confuses me, specif when dealing with SQLserver(Express). It seems that sqlserver only accepts the date in...
18
by: Dirk Hagemann | last post by:
Hello, From a zone-file of a Microsoft Active Directory integrated DNS server I get the date/time of the dynamic update entries in a format, which is as far as I know the hours since january 1st...
2
by: nospam | last post by:
I have some data that I need to run date diffs on. The catch is that for some of this data, there is a date value in one of the fields, with no time. It might look like this: ROW DT1 ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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,...
0
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...
0
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
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...

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.