473,380 Members | 1,296 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,380 software developers and data experts.

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 5211
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Richard Liddiment | last post by:
I am using FormatDateTime( mydbDate, vbShortDate) but it is NOT returning the date formatted according to my regional settings. My regional settings are "dd/MM/yyyy" but my date is returned as...
7
by: Colin Steadman | last post by:
I'm returning a date (5th Jan 2004) from Oracle using the following query: select TO_CHAR(invoice_date,'DD/MM/YYYY') from... This should return my date in the UK format, and it certainly...
1
by: OKI | last post by:
Hi. I had a VB program that was using an SQL Server 6.5 DB. Date format was dd/mm/yyyy. Now the DB was changed to an SQL Server 7 and the date format is yyyy/mm/dd. How can I do for changing...
1
by: Laurence Neville | last post by:
This is regarding a change in the Short Date format under Hebrew Regional Settings, that has caused huge problems in our ASP web application. The change appears to have been introduced sometime...
0
by: Karunakararao | last post by:
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...
5
by: Ishaan | last post by:
Hi, Is there any way to pick the data format from operating system settings using C#? I am doing an ASP.Net Application. -- Software engineer Petroleum Development Oman
7
by: Fred Flintstone | last post by:
I'm writing a VB.Net windows forms application. This line of code: Personal.EffectiveDate = GridRow2.Cells("New Value").Value.ToString.Trim Fails with this error: Cast from string...
7
by: Richiep | last post by:
I am trying to get a UK format date of dd/mm/yyyy. Why does the following subroutine not return a valid date in a web form? The date returned is #12:00:00 AM# but the date I entered into the...
30
by: fniles | last post by:
On my machine in the office I change the computer setting to English (UK) so the date format is dd/mm/yyyy instead of mm/dd/yyyy for US. This problem happens in either Access or SQL Server. In the...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.