Converting to different date format.....

Discussion in 'ASP .Net' started by Gary Smith, Feb 14, 2004.

  1. Gary Smith

    Gary Smith Guest

    How to convert date into different formats in ASP.Net ?
    Thanks,
    Gary
     
    Gary Smith, Feb 14, 2004
    #1
    1. Advertisements

  2. Gary Smith

    Teemu Keiski Guest

    Hi,

    for display purposes you can use string formatting.

    DateTime dt=DateTime.Now;
    string dtDisplay=dt.ToString("dd.MM.yyyy"); //would produce 14.02.2004

    See the documentation for String formatting. Here are the blocks use can use
    to build custom formatting patterns:
    http://msdn.microsoft.com/library/d...globalizationdatetimeformatinfoclasstopic.asp

    --
    Teemu Keiski
    MCP, Microsoft MVP (ASP.NET), AspInsiders member
    ASP.NET Forum Moderator, AspAlliance Columnist


    "Gary Smith" <> wrote in message
    news:%23P$...
    How to convert date into different formats in ASP.Net ?
    Thanks,
    Gary
     
    Teemu Keiski, Feb 14, 2004
    #2
    1. Advertisements

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

    Converting date value to US format

    Bogdan Zamfir, Aug 18, 2003, in forum: ASP .Net
    Replies:
    1
    Views:
    1,596
    Michal A. Valasek
    Aug 18, 2003
  2. Brian Candy
    Replies:
    2
    Views:
    1,410
    Janaka
    Feb 18, 2004
  3. Peter Grison

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,756
    Michael Borgwardt
    May 30, 2004
  4. Rob Meade
    Replies:
    13
    Views:
    9,490
    jaber_souqi
    Mar 26, 2007
  5. =?Utf-8?B?QWxvayB5YWRhdg==?=

    Converting Date Time Format

    =?Utf-8?B?QWxvayB5YWRhdg==?=, Oct 5, 2006, in forum: ASP .Net
    Replies:
    9
    Views:
    915
    Mark Rae
    Oct 10, 2006
  6. deepak
    Replies:
    0
    Views:
    564
    deepak
    Feb 14, 2008
  7. tekion
    Replies:
    4
    Views:
    873
    tekion
    Dec 21, 2009
  8. Fei Liu
    Replies:
    21
    Views:
    3,112
    John Bokma
    Dec 16, 2006
Loading...