pick Date format from Opearating System

G

Guest

Hi,

Is there any way to pick the data format from operating system settings
using C#?
I am doing an ASP.Net Application.
 
S

Scott Allen

HI Ishaan:

Take a look at System.Globalization.CultureInfo (and the
CurrentCulture property of the class).

HTH,
 
G

Guest

I am able to get 'Locale" information eg:=English(US),English(UK),etc...
from "Control Panel->regional options-> General" programatically using
'CultureInfo ' class. I could get the date format using below code

Thread.CurrentThread.CurrentCulture
=CultureInfo.CreateSpecificCulture(Request.UserLanguages[0]);

But We can put a specific data format under "Control Panel->regional
options-> Date" . It does not matter what LACALE is. Is there any way to get
that format from "Control Panel->regional options-> Date".

Please help me to solve this problem.
 
S

Scott Allen

Hi Ishaan:

You can instantiate a CultureInfo and pass a true as the second
parameter to the constructor. This tells the ctor to use user-selected
culture settings from the system.

HTH,

--
Scott
http://www.OdeToCode.com/blogs/scott/

I am able to get 'Locale" information eg:=English(US),English(UK),etc...
from "Control Panel->regional options-> General" programatically using
'CultureInfo ' class. I could get the date format using below code

Thread.CurrentThread.CurrentCulture
=CultureInfo.CreateSpecificCulture(Request.UserLanguages[0]);

But We can put a specific data format under "Control Panel->regional
options-> Date" . It does not matter what LACALE is. Is there any way to get
that format from "Control Panel->regional options-> Date".

Please help me to solve this problem.


Scott Allen said:
HI Ishaan:

Take a look at System.Globalization.CultureInfo (and the
CurrentCulture property of the class).

HTH,
 
S

Scott Allen

Hi Ishann:

You could populate a hidden form field with JavaScript to post to the
server, as shown here:
http://developer.irt.org/script/785.htm

Just be aware this is not a secure and foolproof way, as any client
could easily fake or forge a time (or just have the system clock set
incorrectly).

--
Scott
http://www.OdeToCode.com/blogs/scott/

I want to get that date format from client PC programatically. Can any body
help me on this?

Scott Allen said:
Hi Ishaan:

You can instantiate a CultureInfo and pass a true as the second
parameter to the constructor. This tells the ctor to use user-selected
culture settings from the system.

HTH,

--
Scott
http://www.OdeToCode.com/blogs/scott/

I am able to get 'Locale" information eg:=English(US),English(UK),etc...
from "Control Panel->regional options-> General" programatically using
'CultureInfo ' class. I could get the date format using below code

Thread.CurrentThread.CurrentCulture
=CultureInfo.CreateSpecificCulture(Request.UserLanguages[0]);

But We can put a specific data format under "Control Panel->regional
options-> Date" . It does not matter what LACALE is. Is there any way to get
that format from "Control Panel->regional options-> Date".

Please help me to solve this problem.


:

HI Ishaan:

Take a look at System.Globalization.CultureInfo (and the
CurrentCulture property of the class).

HTH,

--
Scott
http://www.OdeToCode.com/blogs/scott/

On Sun, 17 Oct 2004 21:13:11 -0700, Ishaan

Hi,

Is there any way to pick the data format from operating system settings
using C#?
I am doing an ASP.Net Application.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top