Formatting DateTime with an offset

Discussion in 'ASP .Net' started by Untitled, Jun 15, 2007.

  1. Untitled

    Untitled Guest

    I have an application that stores all DateTime inforamtion in UTC.
    However, this application will be accessed from arround the world. I
    would like my users to be able to specify their prefered TimeZone.
    >From then on, i would like all DateTime information to be displayed in

    their timezone.

    I have written the code to do the timezone conversion. Now what
    remains is finding a way to make every DateTime display in my
    application use this code and get converted. I've tried to use the
    culture info, the DateTimeFormatInfo class, i've even tried to make my
    own custom formatter. No matter what I do, I can't seem to get my
    DateTime.ToString() to go through my conversion code.

    I have a lot of web pages, going through every page and every grid and
    manually making a conversion would be tedious and prone to error. I'd
    rather have DateTime.ToString go through some kind of formatting that
    i am completely in control over and then i can do my formatting and
    converting there.
    Any help?
     
    Untitled, Jun 15, 2007
    #1
    1. Advertising

  2. Untitled

    bruce barker Guest

    DateTime a is sealed value type so you can not extend it. You will have
    to write a class that encapsulates it. then its ToString() can do what
    you want.

    -- bruce (sqlwork.com)


    Untitled wrote:
    > I have an application that stores all DateTime inforamtion in UTC.
    > However, this application will be accessed from arround the world. I
    > would like my users to be able to specify their prefered TimeZone.
    >>From then on, i would like all DateTime information to be displayed in

    > their timezone.
    >
    > I have written the code to do the timezone conversion. Now what
    > remains is finding a way to make every DateTime display in my
    > application use this code and get converted. I've tried to use the
    > culture info, the DateTimeFormatInfo class, i've even tried to make my
    > own custom formatter. No matter what I do, I can't seem to get my
    > DateTime.ToString() to go through my conversion code.
    >
    > I have a lot of web pages, going through every page and every grid and
    > manually making a conversion would be tedious and prone to error. I'd
    > rather have DateTime.ToString go through some kind of formatting that
    > i am completely in control over and then i can do my formatting and
    > converting there.
    > Any help?
    >
     
    bruce barker, Jun 16, 2007
    #2
    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. Lance Riedel

    Translated Offset to Source Offset

    Lance Riedel, Oct 14, 2003, in forum: XML
    Replies:
    2
    Views:
    524
    Patrick TJ McPhee
    Oct 15, 2003
  2. Christos TZOTZIOY Georgiou
    Replies:
    3
    Views:
    760
    Christos TZOTZIOY Georgiou
    Sep 13, 2003
  3. Tim Peters
    Replies:
    0
    Views:
    598
    Tim Peters
    Sep 9, 2003
  4. mp
    Replies:
    1
    Views:
    440
    John Machin
    Jul 28, 2006
  5. Roy Smith
    Replies:
    4
    Views:
    313
    Roy Smith
    Jan 27, 2013
Loading...

Share This Page