V
Vilcoyote
Here is the problem. I need to display a date in the en-US format (6:00
PM and not 18:00). Theorically there are many ways to get a short date
format string from a date:
myDate.ToString("t")
myDate.ToString("h:mm tt")
myDate.ToShortTimeString()
and the most complete one:
myDate.ToString(new
CultureInfo("en-US").DateTimeFormat.ShortTimePattern)
Well none of these work properly...here are the results i get if the
time of my dateTime is 6:00 PM
myDate.ToString("t") --> 18:00
myDate.ToShortTimeString() --> 18:00
myDate.ToString("h:mm tt") --> 6:00
myDate.ToString(new
CultureInfo("en-US").DateTimeFormat.ShortTimePattern) --> 6:00
It's like the "t" symbol isn't even recognized...
int fact, if i just do DateTime.Now in the immediate window of Visual
Studio, the AM/PM doesn't show either.
Now the weirdest thing, I have a similar project where everything works
just fine (it is in fact the previous version of the same project, i
just took the class and put it in a brand new project). Both project
are done in Visual Studio 2005, DotNet 2.0, on the same computer. I can
run them at the same time, one will work (the old one) and one will
have this weird bug (the one that needs to work, of course, or it
wouldn't be fun).
If anyone has ever had that same problem, i'll be glad to know how they
solved the problem (if they did).
Thanks in advance.
PM and not 18:00). Theorically there are many ways to get a short date
format string from a date:
myDate.ToString("t")
myDate.ToString("h:mm tt")
myDate.ToShortTimeString()
and the most complete one:
myDate.ToString(new
CultureInfo("en-US").DateTimeFormat.ShortTimePattern)
Well none of these work properly...here are the results i get if the
time of my dateTime is 6:00 PM
myDate.ToString("t") --> 18:00
myDate.ToShortTimeString() --> 18:00
myDate.ToString("h:mm tt") --> 6:00
myDate.ToString(new
CultureInfo("en-US").DateTimeFormat.ShortTimePattern) --> 6:00
It's like the "t" symbol isn't even recognized...
int fact, if i just do DateTime.Now in the immediate window of Visual
Studio, the AM/PM doesn't show either.
Now the weirdest thing, I have a similar project where everything works
just fine (it is in fact the previous version of the same project, i
just took the class and put it in a brand new project). Both project
are done in Visual Studio 2005, DotNet 2.0, on the same computer. I can
run them at the same time, one will work (the old one) and one will
have this weird bug (the one that needs to work, of course, or it
wouldn't be fun).
If anyone has ever had that same problem, i'll be glad to know how they
solved the problem (if they did).
Thanks in advance.