Go Back   Velocity Reviews > Newsgroups > ASP Net
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

ASP Net - DateTime.ToShortTimeString

 
Thread Tools Search this Thread
Old 11-14-2003, 07:40 PM   #1
Default DateTime.ToShortTimeString


I have some questions about datetime formatting....In our web app I have the
following in the web.config
<globalization
requestEncoding="utf-8"
responseEncoding="utf-8"
culture="en-US"
uiCulture="en-US"

Based on 3:00 pm time
Now whenever I use DateTime.toShortTimeString I get "3:00 P.M" but what I
really want is "15:00". Do I have to use DateTime.toString("HH:MM")? If I
"hard code" that in my app how will that affect things if my culture changes
to say German? (or is military time universal?) What other things should I
be doing to ensure that our app can be "globalized"?

thanks
Doug
--
Doug Swanson
Senior Applications Developer
Synchrono, Inc
651.228.1772





Doug Swanson
  Reply With Quote
Old 11-16-2003, 06:11 AM   #2
Natty Gur
 
Posts: n/a
Default Re: DateTime.ToShortTimeString
Hi,

1) Generally it's good practice to format your data and time to your
chosen format and not to relay on the machine settings. Remember that
any user / administrator can change formats.

2) If you will "hard code" date/time formats it want effects culture
settings:
string date = dt.ToString("D"); produce English string or Hebrew string
depends on culture settings.

blog : http://weblogs.asp.net/ngur
Mobile: +972-(0)58-888377


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


Natty Gur
  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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

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




SEO by vBSEO 3.3.2 ©2009, Crawlability, Inc.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46