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

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

    Converting date value to US format

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

    Date, date date date....

    Peter Grison, May 28, 2004, in forum: Java
    Replies:
    10
    Views:
    3,365
    Michael Borgwardt
    May 30, 2004
  4. Rob Meade
    Replies:
    13
    Views:
    9,416
    jaber_souqi
    Mar 26, 2007
  5. Fei Liu
    Replies:
    21
    Views:
    2,485
    John Bokma
    Dec 16, 2006
Loading...

Share This Page