PC Review


Reply
Thread Tools Rate Thread

How to display time from a datetime

 
 
Herve Bocuse
Guest
Posts: n/a
 
      1st Nov 2005
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

 
Reply With Quote
 
 
 
 
Vadym Stetsyak
Guest
Posts: n/a
 
      2nd Nov 2005
you'll have to use some culture info

DateTime date = DateTime.Now;
string key =
date.ToString("MM/dd/yyyy",System.Globalization.DateTimeFormatInfo.CultureIn
fo);

--
Vadym Stetsyak aka Vadmyst
http://vadmyst.blogspot.com


"Herve Bocuse" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>



 
Reply With Quote
 
Herve Bocuse
Guest
Posts: n/a
 
      2nd Nov 2005
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

 
Reply With Quote
 
sp3d2orbit
Guest
Posts: n/a
 
      2nd Nov 2005
Have you looked at Date.ToShortDateString()?

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
datetime field display xbound Microsoft Access ADP SQL Server 2 27th May 2010 09:25 PM
DateTime.Now returns incorrect time after time zone change RFlaugher Microsoft Dot NET Compact Framework 8 12th Apr 2010 05:14 PM
How do I display time with date in a DataGrid from a DateTime data column? Jim H Microsoft C# .NET 3 23rd Oct 2004 09:52 AM
DateTime Class shows wrong time when Time Zone is changed Dave Hall Microsoft Dot NET Compact Framework 6 14th Jul 2004 06:05 PM
datetime display 'date' only. Agnes Microsoft VB .NET 1 14th Jul 2004 11:12 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:21 PM.