How to display time from a datetime

  • Thread starter Thread starter Herve Bocuse
  • Start date Start date
H

Herve Bocuse

Hi,

I have a datetime variable. I would like to display it as the system
does (as it was chosen by the user in the regional settings). I can
find how to write it as short time or long time but not as defined in
the control panel.

Thank you

Herve
 
you'll have to use some culture info

DateTime date = DateTime.Now;
string key =
date.ToString("MM/dd/yyyy",System.Globalization.DateTimeFormatInfo.CultureIn
fo);
 
But here you explicitely choose the format MM/dd/yyyy.
In my case I don't want to force a format, I want to apply the one
chosen by the user in the regional settings. For example if he modified
the time format, I want this format.

Thank you

Herve
 
Back
Top