Results 1 to 4 of 4

Thread: Date format

  1. #1

    Thread Starter
    New Member
    Join Date
    Jun 2003
    Posts
    2

    Question Date format

    Does anyone knoes how to changed the format of the date.
    for example by default the date is 9/7/03..is there anyway to changed it to 9th july 2003????? all help are apreciated...

  2. #2
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083

    Re: Date format

    One way of changing date format is like this :

    VB Code:
    1. TextBox5.Text() = Format(Now.Today(), "")

    or

    VB Code:
    1. MessageBox.Show(Format(Now.Today(), "dddd, MMM yyyy"))

    the other way , you can use datetime picker .

  3. #3
    Lively Member
    Join Date
    Jan 2000
    Location
    treehouse
    Posts
    106
    'Will this work for you?

    Const ST As String = "st"
    Const ND As String = "nd"
    Const RD As String = "rd"
    Const TH As String = "th"

    Dim CurrentDay As String = Format$(Now(), "dd")
    Dim CurrentMonth As String = Format$(Now(), "MMMM")
    Dim CurrentYear As String = Format$(Now(), "yyyy")

    Select Case CurrentDay
    Case "01", "21", "31"
    CurrentDay += ST
    Case "02", "22"
    CurrentDay += ND
    Case "03", "23"
    CurrentDay += RD
    Case Else
    CurrentDay += TH
    End Select

    MsgBox(CurrentDay & " " & CurrentMonth & " " & CurrentYear)

  4. #4
    PowerPoster hellswraith's Avatar
    Join Date
    Jul 2002
    Location
    Washington St.
    Posts
    2,464
    OR
    Dim myDate AS System.DateTime = New System.DateTime.Now()
    MessageBox.Show(myDate.ToString("d/m/yy")

    I didn't test it, but it will be similar to it. The ToString method is overloaded and you can supply a formatting string to get the desired results.

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