Convert date

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?

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
 
A

Armin Zingler

simon said:
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?

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?


I don't understand the question. Where do you "get" something? ParseExact
returns a Date object, not a formatted string. Where do you create the
string and where does it appear in the wrong format?
 
S

simon

Thank you, it works now.
I tried everything, functions and culture settings and at the end just
instead of hh: HH :)
I wouldnt found this by myself.

Best regards from Slovenia,
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

Similar Threads


Top