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

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

Similar topics

2
by: cg_news | last post by:
In short, what I am trying to do is, based on a date, calculate the week of year (as described in ISO 8601), then calculate the first and last date in this week period and return them in the format...
4
by: peashoe | last post by:
I have an asp page that uses a calendar.js (pop-up) file to add an exact date format in the text field (txtDDate). My problem is I need some javascript that sets an alert that does not allow them...
6
by: Willie wjb | last post by:
Hi, i have a client program that sends a filter expression to the server PC. On that server PC this filter is put over a datatable and the result is send back. the server can be located on a...
9
by: Shapper | last post by:
Hello, I created a dataset from a XML file. One of the dataset fields is . In an ASP:Repeater I am displaying the field. <%# DataBinder.Eval(Container.DataItem, "pubDate", "{0:f}") %> The...
3
by: Ivan V via DotNetMonster.com | last post by:
Dear All: I got a serious problem in updating the date field from vb.net to abd dbf file. My code is as follow: Dim ConnectionString As String Dim cake As Date = Date.Parse(idate) ...
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...
6
by: NH | last post by:
I want to allow users to enter dates in a text box in either the US "MM dd yy" format or the UK "dd MM yy" format. But how can I validate these dates? All the date functions e.g. ISdate,...
0
by: abhya | last post by:
I want to make the Program which run and Save, Update, Insert Date of Customer. Which is Run Independent of System Date. It works Fine if the System Date( Using regional Setting) in US format...
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.