Results 1 to 5 of 5

Thread: Date Formatting

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Mar 2004
    Posts
    17

    Date Formatting

    I am running a SmartDevice application on a handheld and want to display the current date/time. The current format it is displaying when I use the Now function is:

    mm/dd/yy hh/mm/ss AM/PM

    I would like it to be:

    mm/dd/yyyy hh/mm/ss AM/PM

    How do I do this?

  2. #2
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    If I read you right, maybe something like
    VB Code:
    1. MessageBox.Show(Format(Now, "MM/dd/yyyy hh/mm/ss tt"))

    Check out User-Defined Date/Time Formats and (Format Function) and Predefined Date/Time Formats (Format Function) in MSDN.

    HTH,
    Mike

  3. #3
    Lively Member mindloop's Avatar
    Join Date
    Mar 2004
    Posts
    64
    if you are using DateTimePicker:
    VB Code:
    1. Me.DateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Custom
    2. Me.DateTimePicker1.CustomFormat = "mm/dd/yyyy hh/mm/ss AM/PM"
    ehmm...

  4. #4
    Fanatic Member pvbangera's Avatar
    Join Date
    Sep 2001
    Location
    Mumbai, India
    Posts
    961
    dont forget to keep your 'mm' in upper case.

    dd/mm/yyyy wont work

    dd/MM/yyyy will work

    regards

  5. #5
    Lively Member mindloop's Avatar
    Join Date
    Mar 2004
    Posts
    64
    yepp it was my mistake.
    it should be
    VB Code:
    1. Me.DateTimePicker1.Format = System.Windows.Forms.DateTimePickerFormat.Custom
    2. Me.DateTimePicker1.CustomFormat = "MM/dd/yyyy"
    ehmm...

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