473,946 Members | 10,261 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 3848
HI Ishaan:

Take a look at System.Globaliz ation.CultureIn fo (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****@discuss ions.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),et c...
from "Control Panel->regional options-> General" programatically using
'CultureInfo ' class. I could get the date format using below code

Thread.CurrentT hread.CurrentCu lture
=CultureInfo.Cr eateSpecificCul ture(Request.Us erLanguages[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.Globaliz ation.CultureIn fo (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****@discuss ions.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****@discuss ions.microsoft. com> wrote:
I am able to get 'Locale" information eg:=English(US) ,English(UK),et c...
from "Control Panel->regional options-> General" programatically using
'CultureInfo ' class. I could get the date format using below code

Thread.Current Thread.CurrentC ulture
=CultureInfo.C reateSpecificCu lture(Request.U serLanguages[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.Globaliz ation.CultureIn fo (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****@discuss ions.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****@discuss ions.microsoft. com> wrote:
I am able to get 'Locale" information eg:=English(US) ,English(UK),et c...
from "Control Panel->regional options-> General" programatically using
'CultureInfo ' class. I could get the date format using below code

Thread.Current Thread.CurrentC ulture
=CultureInfo.C reateSpecificCu lture(Request.U serLanguages[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.Globaliz ation.CultureIn fo (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****@discuss ions.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****@discuss ions.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****@discuss ions.microsoft. com> wrote:
>I am able to get 'Locale" information eg:=English(US) ,English(UK),et c...
>from "Control Panel->regional options-> General" programatically using
>'CultureInfo ' class. I could get the date format using below code
>
>Thread.Current Thread.CurrentC ulture
>=CultureInfo.C reateSpecificCu lture(Request.U serLanguages[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.Globaliz ation.CultureIn fo (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****@discuss ions.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
14889
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 CCYYMMDD. Sounds easy enough, right?? I am attempting to accomplish this by creating a GregorianCalender which will get me the week of year. Then by changing the day of week to 1 (start of week) i'm trying the get the first day of the week,...
4
3465
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 to select today. example: var dtToday = Date() if(document.frmSoftware.txtDDate.value == dtToday) { alert("You cannot select same day distributions. Please enter a new
6
3305
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 PC with let's say ddmmyyyy windows date format and the client has mmddyyyy. when the filter expression send is "Date < #31/01/2003#", it will fail on
9
1985
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 date displayed has the following format, the same as in the XML file:
3
8828
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) Console.WriteLine(Format(cake, "MM/dd/yyyy"))
7
6830
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 text box was 24/06/2006. The other solution I have tried is given by the following two lines that do not compile because a value of date type cannot be converted to datetime:
6
2906
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, convert.ToDatetime etc fail on the US date format as the application and IIS is set to UK format. Its strange that the date format("12/03/06","MM dd yy") is interpretated correctly but format("12/22/06","MM dd yy") bombs out.
0
246
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 i.e. MM/dd/yyyy. But what are the Changes Should be Made if System Date is in format dd/ MM/yyyy. In my program i hav manuaaly Convert Date(To Displayed as Output) to Desire Format... But for Calculation I hav Convert it into US Format.....(As SQl...
30
5747
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 database I have a table with Date/time column. The database is located on a machine that is set to dd/mm/yyyy also. When I enter date 7/1/08 (as in January 7, 2008), it stores it in the database as 1/7/08 instead of 7/1/08. Why is it like that...
0
10151
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9976
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11145
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
11331
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10683
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9881
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8244
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6106
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4932
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.