473,387 Members | 1,535 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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
ds******@synchrono.com
Nov 17 '05 #1
1 2524
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!
Nov 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
by: MGRIDEOUT | last post by:
Hello , I have a sub that gets all records in a table. Then displays the times in a drop-down list (ddlStartTime). My problem is that the ddl contain the date AND time. i.e. 9:00 AM in the...
1
by: NormD | last post by:
I have a DataSet that has several DateTime columns. I retrieve the XML from the DataSet by using its DataSet.GetXML method. This XML gets loaded into an XPathDocument. I've also created a basic...
7
by: Robert Misiak | last post by:
Hello- I live in the US, however I'm attempting to make a product of mine more international-friendly. There are a number of instances where a calendar function of my program displays various...
3
by: David | last post by:
Hello. How can I get only date or only time from DateTime.Now? For example I want to assign current date and current time to some labels. Thank you.
0
by: Prasad More | last post by:
I want to open a TIFF file, put a datetime stamp on it and save that file in CompressionCCITT4 format back to the same filename. I have written following code to do this, but getting "Invalid...
5
by: I am Sam | last post by:
I have created this DateTime object and instanced it I think correctly DateTime myClubNow1=new...
0
by: Vilcoyote | last post by:
Here is the problem. I need to display a date in the en-US format (6:00 PM and not 18:00). Theorically there are many ways to get a short date format string from a date: myDate.ToString("t")...
1
by: chaosblade | last post by:
Hi, I've come across a small issue related to the DateTime class. It seems to not take daylight savings here (Israel, GMT+2\+3 with DST) into consideration, No matter the form used. I've tried...
2
by: csharpula csharp | last post by:
Hello, I am trying to add Date and Current time to a name of a log file. I tried doing this: string logDateExtention = DateTime.Now.ToShortDateString().ToString() +...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.