473,387 Members | 1,575 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,387 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 16 '05 #1
3 7612
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 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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.