in my C# program i receive date & time like this: DateTime.Now
and i get: 19/09/2010 20:10:30 because my region is: Hebrew (Israel)
but What happens if I’ll install my program on computer with region English (united states)
I’ll probably get an error because the format is MM/dd/yyyy hh:mm:ss
my question is, How to ensure that i Always get the date in dd/MM/yyyy hh:mm:ss format ?
in any type of region ?
thank’s in advance
Output just generated:
Just so you know “HH” is 24 hour clock hours, so from 0-23 and “hh” is 12 hour clock hours, so from 1-12. So with “hh” you’d need a “tt” after it. You also generally don’t have the “0” in front of any hours < 10 when using a 12 hour clock.
Like:
All of the format specifiers (so “h”, “mm”, “MM”, etc) can be found here: http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx