convert date

S

simon

if I convert dt with this function:

dt = DateTime.ParseExact(string, "dd.MM.yyyy h:mm:ss",
System.Globalization.CultureInfo.CurrentCulture)

I get as a result:

dt =#12/24/2003 10:00:00 PM#

but I would like to get without PM and AM:

dt= #12/24/2003 22:00:00#
or in fact:
dt= #24.12.2003 22:00:00#

How can I set that, change the
System.Globalization.CultureInfo.CurrentCulture?

Thank you,
Simon
 
B

Bill Styles

simon said:
if I convert dt with this function:

dt = DateTime.ParseExact(string, "dd.MM.yyyy h:mm:ss",
System.Globalization.CultureInfo.CurrentCulture)

I get as a result:

dt =#12/24/2003 10:00:00 PM#

but I would like to get without PM and AM:

dt= #12/24/2003 22:00:00#
or in fact:
dt= #24.12.2003 22:00:00#

How are you examing dt? It sounds like you are simply seeing the default
date/time display format on your system. Try
dt.ToString("dd.MM.yyyy h:mm:ss")
 
S

simon

The default date-time format is what I would like to get.
My default (in windows) is: 24.12.2003 22:00:00

But with System.Globalization.CultureInfo.CurrentCulture I get american
values, also in my activeX:dateTimePicker I also get american values. I
would like to change it but I don't know where?

Thank you for your answer,
Simon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top