469,336 Members | 6,129 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

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

pick Date format from Opearating System

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
Nov 18 '05 #1
5 3677
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
<Is****@discussions.microsoft.com> wrote:
Hi,

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


Nov 18 '05 #2
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.UserLan guages[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" wrote:
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
<Is****@discussions.microsoft.com> wrote:
Hi,

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


Nov 18 '05 #3
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/

On Mon, 18 Oct 2004 21:41:05 -0700, Ishaan
<Is****@discussions.microsoft.com> wrote:
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.UserLa nguages[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" wrote:
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
<Is****@discussions.microsoft.com> wrote:
>Hi,
>
>Is there any way to pick the data format from operating system settings
>using C#?
>I am doing an ASP.Net Application.



Nov 18 '05 #4
I want to get that date format from client PC programatically. Can any body
help me on this?

"Scott Allen" wrote:
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/

On Mon, 18 Oct 2004 21:41:05 -0700, Ishaan
<Is****@discussions.microsoft.com> wrote:
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.UserLa nguages[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" wrote:
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
<Is****@discussions.microsoft.com> wrote:

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


Nov 18 '05 #5
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/

On Tue, 19 Oct 2004 20:39:03 -0700, Ishaan
<Is****@discussions.microsoft.com> wrote:
I want to get that date format from client PC programatically. Can any body
help me on this?

"Scott Allen" wrote:
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/

On Mon, 18 Oct 2004 21:41:05 -0700, Ishaan
<Is****@discussions.microsoft.com> wrote:
>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.UserLa nguages[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" wrote:
>
>> 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
>> <Is****@discussions.microsoft.com> wrote:
>>
>> >Hi,
>> >
>> >Is there any way to pick the data format from operating system settings
>> >using C#?
>> >I am doing an ASP.Net Application.
>>
>>



Nov 18 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by cg_news | last post: by
4 posts views Thread by peashoe | last post: by
9 posts views Thread by Shapper | last post: by
3 posts views Thread by Ivan V via DotNetMonster.com | last post: by
6 posts views Thread by NH | last post: by
reply views Thread by abhya | last post: by
30 posts views Thread by fniles | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.