Dates displaying in US format

Discussion in 'ASP .Net' started by Sheila Jones, Feb 16, 2004.

  1. Sheila Jones

    Sheila Jones Guest

    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.
     
    Sheila Jones, Feb 16, 2004
    #1
    1. Advertising

  2. 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.
    >
    >
     
    Patrice Scribe, Feb 16, 2004
    #2
    1. Advertising

  3. Sheila Jones

    Sheila Jones Guest

    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.
    > >
    > >

    >
     
    Sheila Jones, Feb 16, 2004
    #3
  4. 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.
    > > >
    > > >

    > >

    >
    >
     
    Patrice Scribe, Feb 16, 2004
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. David Lozzi

    Dates dates dates dates... SQL and ASP.NET

    David Lozzi, Sep 29, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    896
    Rob Schieber
    Sep 30, 2005
  2. PW

    Dates! Dates! Dates!

    PW, Aug 7, 2004, in forum: ASP General
    Replies:
    4
    Views:
    223
    Mark Schupp
    Aug 9, 2004
  3. Replies:
    1
    Views:
    229
    Jano Svitok
    Jul 17, 2007
  4. kellygreer1

    RFC-822 dates into Ruby dates

    kellygreer1, Jun 8, 2008, in forum: Ruby
    Replies:
    1
    Views:
    233
    Eric I.
    Jun 8, 2008
  5. Dr J R Stockton

    FAQ Dates; Opera Dates.

    Dr J R Stockton, Jun 18, 2007, in forum: Javascript
    Replies:
    0
    Views:
    181
    Dr J R Stockton
    Jun 18, 2007
Loading...

Share This Page