473,327 Members | 2,007 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,327 software developers and data experts.

Changing date format

Can someone please tell me how I can change the date format (e.g dd/mm/yyyy,
mm/dd/yyyy) in a configuration file?

In my windows app, I can retrieve the windows setting but not my ASP.NET
application.

TIA
GP
Nov 22 '05 #1
1 1786
Hi,

Do you mean to say you have to pick up the format from the config file and
use that? If that is the case, then you just need to do store your setting
in Web.Config and then use ConfigurationSettings.AppSettings (or GetConfig ,
whichever) and then pass the format to the ToString method of your DateTime
structure instance.
Something like:
myDt.ToString(ConfigurationSettings.AppSettings("D ateFormat"))

Be it a windows app or a web app, you can get the current machine's settings
by calling the CultureInfo.InstalledUICulture property. You can extract
Date/time/currency formats from this instance of CultureInfo by using
properties like DateTimeFormat etc..CultureInfo BTW, is in
System.Globalization namespace.

As a better practice, you might consider passing a CultureInfo instance
(implements IFormatProvier) the ToString method or change the current
thread's Culture to display the dates in those corresponding formats, since
date/time formats are culture specific.
--
HTH,
Manoj G [.NET MVP]
http://www15.brinkster.com/manoj4dotnet

PS: Pls avoid cross NG posting as much as possible.

"Gani Pola" <ga******@pcidata.net> wrote in message
news:OC******************@news-server.bigpond.net.au...
Can someone please tell me how I can change the date format (e.g dd/mm/yyyy, mm/dd/yyyy) in a configuration file?

In my windows app, I can retrieve the windows setting but not my ASP.NET
application.

TIA
GP

Nov 22 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Shaiboy_UK | last post by:
Hi All, Sorry if this is the wrong newsgroup to post into, on this topic, if so, please point me in the right direction..... Currently working on a ASP for a friend, which requires the date...
8
by: Rob | last post by:
Hi all, Is it possible to change the Session.LCID in a hyperlink? My problem is I'm calling a Date from a database to use as a querystring in the hyperlink but I also need to display the date as...
6
by: Suzanne | last post by:
Hi, I am having problems with my website which uses ASP. It is switching between American and European date formats - this is causing problems on the page which use the Date function. Most of...
1
by: jt | last post by:
I posted this yesterday, but I am not seeing this out yet: I am having problems with updating a date field in a certain format. The data is stored in an Oracle database. The date is...
2
by: Chris | last post by:
Hello, i'm using a form with 2 dates in the format mm/dd/yyyy in it. I wanna calculate the days between the two dates. I tried it like this: <script language="JavaScript"> var date1 = new...
2
by: bh | last post by:
Changing a Date Time Value I have a form with a date time picker or it and a button. When the button is pressed it passes the date/time into a stored procedure that queries an SQL database. ...
20
by: andreas | last post by:
When I copy a vb.net project using date formats from one PC with a windows date format f.e. dd/mm/yyyy to another PC having a format yy/mm/dd then I get errors. How can I change for a while in the...
0
by: Kyote | last post by:
In my project I have an underlying Access DB. One of the column's is currently set as a text field but I need to change it to a date/time field. I can open the Access DB in MS Access and change...
5
mgpsivan
by: mgpsivan | last post by:
Hi, i have form in Asp.net(2003) in that i've to change the format of the date by the following statement Format(Date.Today, "dd/mm/yyyy") but when i give this code the month part displays as...
0
by: Just4U | last post by:
Hello, My config : Windows 2003 x64 (US VERSION) + sp2, IIS 6 All regional settings to French (even for default user) In my ASP pages dates are in the good format (french:dd/mm/yyyy), but...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

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.