Results 1 to 3 of 3

Thread: [RESOLVED] [1.0/1.1] Format date to yyyymmddhhmmss

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Apr 2006
    Posts
    73

    Resolved [RESOLVED] [1.0/1.1] Format date to yyyymmddhhmmss

    Can someone show me how to display the current time & date in a message box .. format in yyyymmddhhmmss?

    sorry i am new to C#. pls help me out. thks

    longwar
    Last edited by Hack; May 18th, 2006 at 05:48 AM. Reason: Added [RESOLVED] to thread title and green "resolved" checkmark

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: [1.0/1.1] Format date to yyyymmddhhmmss

    Code:
    MessageBox.Show(DateTime.Now.ToString("yyyyMMddHHmmss"));
    Note that upper case "M" is used for month and lower case for minute. Also, upper case "H" indicates 24 hour time and lower case indicates 12 hour. You can include "tt" to show "AM" or "PM" with 12 hour time.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Apr 2006
    Posts
    73

    Re: [1.0/1.1] Format date to yyyymmddhhmmss

    thks very much. jmcilhinney

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width