Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > Dates displaying in US format

Reply
Thread Tools

Dates displaying in US format

 
 
Sheila Jones
Guest
Posts: n/a
 
      02-16-2004
Hello,

I have written a webpage that displays details of some files on the
webserver. It includes the following lines:
FileInfo fi = new FileInfo(file);
cell.Text = fi.CreationTime.ToString();

It works OK, except that the date is displayed in US format
(month/day/year), not UK format. The help file for DateTime.ToString says
"This method uses formatting information derived from the current culture".
So obviously, the 'current culture' is set incorrectly. Where and how do I
change this?

Thanks.


 
Reply With Quote
 
 
 
 
Patrice Scribe
Guest
Posts: n/a
 
      02-16-2004
If you need always the same formatting, you could change it using the
web.config file (see the Globalization entry in the documentation).

If you need to work with multiple culture you could also set it
programmatically using Page.Culture or by changing the culture on the
current thread....

Patrice

--

"Sheila Jones" <> a écrit dans le message de
news:...
> Hello,
>
> I have written a webpage that displays details of some files on the
> webserver. It includes the following lines:
> FileInfo fi = new FileInfo(file);
> cell.Text = fi.CreationTime.ToString();
>
> It works OK, except that the date is displayed in US format
> (month/day/year), not UK format. The help file for DateTime.ToString says
> "This method uses formatting information derived from the current

culture".
> So obviously, the 'current culture' is set incorrectly. Where and how do I
> change this?
>
> Thanks.
>
>


 
Reply With Quote
 
 
 
 
Sheila Jones
Guest
Posts: n/a
 
      02-16-2004
Hello Patrice,

Thank you for your reply. But why doesn't ASP.Net default to using the
machine's Regional Settings? That would seem more logical to me.


"Patrice Scribe" <> wrote in message
news:...
> If you need always the same formatting, you could change it using the
> web.config file (see the Globalization entry in the documentation).
>
> If you need to work with multiple culture you could also set it
> programmatically using Page.Culture or by changing the culture on the
> current thread....
>
> Patrice
>
> --
>
> "Sheila Jones" <> a écrit dans le message de
> news:...
> > Hello,
> >
> > I have written a webpage that displays details of some files on the
> > webserver. It includes the following lines:
> > FileInfo fi = new FileInfo(file);
> > cell.Text = fi.CreationTime.ToString();
> >
> > It works OK, except that the date is displayed in US format
> > (month/day/year), not UK format. The help file for DateTime.ToString

says
> > "This method uses formatting information derived from the current

> culture".
> > So obviously, the 'current culture' is set incorrectly. Where and how do

I
> > change this?
> >
> > Thanks.
> >
> >

>



 
Reply With Quote
 
Patrice Scribe
Guest
Posts: n/a
 
      02-16-2004
Good point though this sometimes not easy (should the system default or the
account default used ?).
The nice thing with web.config is that you have control without regards to
server settings...

For now I'm unable to find where in the doc is specified what the default
cutlture should be...
(we have no problem here as we usually set it from the user profile).

Patrice

--

"Sheila Jones" <> a écrit dans le message de
news:...
> Hello Patrice,
>
> Thank you for your reply. But why doesn't ASP.Net default to using the
> machine's Regional Settings? That would seem more logical to me.
>
>
> "Patrice Scribe" <> wrote in message
> news:...
> > If you need always the same formatting, you could change it using the
> > web.config file (see the Globalization entry in the documentation).
> >
> > If you need to work with multiple culture you could also set it
> > programmatically using Page.Culture or by changing the culture on the
> > current thread....
> >
> > Patrice
> >
> > --
> >
> > "Sheila Jones" <> a écrit dans le message de
> > news:...
> > > Hello,
> > >
> > > I have written a webpage that displays details of some files on the
> > > webserver. It includes the following lines:
> > > FileInfo fi = new FileInfo(file);
> > > cell.Text = fi.CreationTime.ToString();
> > >
> > > It works OK, except that the date is displayed in US format
> > > (month/day/year), not UK format. The help file for DateTime.ToString

> says
> > > "This method uses formatting information derived from the current

> > culture".
> > > So obviously, the 'current culture' is set incorrectly. Where and how

do
> I
> > > change this?
> > >
> > > Thanks.
> > >
> > >

> >

>
>


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
RFC-822 dates into Ruby dates kellygreer1 Ruby 1 06-08-2008 10:59 PM
Need to use dates earlier than 1900 (Time library says out of range for dates < 1900) me@benjaminarai.com Ruby 1 07-17-2007 02:25 PM
FAQ Dates; Opera Dates. Dr J R Stockton Javascript 0 06-18-2007 03:51 PM
Dates dates dates dates... SQL and ASP.NET David Lozzi ASP .Net 1 09-30-2005 02:18 PM
Dates! Dates! Dates! PW ASP General 4 08-09-2004 04:42 PM



Advertisments