469,097 Members | 1,481 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,097 developers. It's quick & easy.

How can i get the date formatted according to the regional settings made at the operating system level

Hi All,

How can i get the date based on Regional settings .
how can i get the date format using C# .NET

" The date displayed in the date/time field should be formatted according to
the regional settings made at the operating system level. For example,
Canada uses a dd/mm/yyyy format while the US uses mm/dd/yyyy. The month and
day should be padded with zeros. In other words, use 01/01/2005 rather than
1/1/2005. The date will always appear as a range"
Please help me

Regards
venu.
Nov 16 '05 #1
3 4999
Karunakararao,

You can get an instance of the DateTimeFormatInfo class from the static
CurrentInfo property on the DateTimeFormatInfo class. Once you have that,
you can pass that to the ToString method to get a string representation of
the date in the local format.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Karunakararao" <ka************@i-vantage.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi All,

How can i get the date based on Regional settings .
how can i get the date format using C# .NET

" The date displayed in the date/time field should be formatted according to the regional settings made at the operating system level. For example,
Canada uses a dd/mm/yyyy format while the US uses mm/dd/yyyy. The month and day should be padded with zeros. In other words, use 01/01/2005 rather than 1/1/2005. The date will always appear as a range"
Please help me

Regards
venu.

Nov 16 '05 #2
Is that really necessary? If you use DateTime.ToShortDateString() it will
automatically format the date in the format specified in the operating
system.

Happy coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #3
Morten,

Necessary, no. The ToShortDateString would work just fine in this
scenario.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Morten Wennevik" <Mo************@hotmail.com> wrote in message
news:opr7scp1tthntkfz@localhost...
Is that really necessary? If you use DateTime.ToShortDateString() it will
automatically format the date in the format specified in the operating
system.

Happy coding!
Morten Wennevik [C# MVP]
Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Richard Liddiment | last post: by
7 posts views Thread by Colin Steadman | last post: by
1 post views Thread by OKI | last post: by
5 posts views Thread by Ishaan | last post: by
7 posts views Thread by Fred Flintstone | last post: by
30 posts views Thread by fniles | last post: by
1 post views Thread by CARIGAR | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.