Results 1 to 4 of 4

Thread: Formating a date

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    879
    How do I format Sunday, October 22, 2000 07:26:00-EDT so that I can get the day number by itself and the month by itself. Then I want to get 07:26:00 into a string!
    Visual Basic 6.0
    Visual C++ 5
    Delphi 5


  2. #2

    Thread Starter
    Fanatic Member
    Join Date
    Aug 2000
    Posts
    879
    I think i new that already, but i didn't use it for a reason! CUZ IT DOESN'T WORK!


    THIS IS WHAT I GET: Sunday, October 22, 2000 08:41:06-EDT
    AND I WANT TO GET EACH WORD BY ITSELF. FOR EXAMPLE:
    SUNDAY <--BY ITSELF
    OCTOBER <--BY ITSELF
    Visual Basic 6.0
    Visual C++ 5
    Delphi 5


  3. #3
    Addicted Member
    Join Date
    Oct 2000
    Location
    Vienna/Austria
    Posts
    132
    hi VIP3R !!!

    Look at the help under "format"

    'day Name
    debug.print format(date(),"dddd")
    'month Name
    debug.print format(date(),"mmmm")

    and so on

    -cu TheOnly

  4. #4
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    Some other cool intrinsic funcitons to look at...

    Here are some other cool VB intrinsic functions you can play with:
    Code:
        MsgBox Now                          ' Displays: "10/29/2000 10:57:30 AM"
        MsgBox Month(Now)                   ' Displays: "10"
        MsgBox MonthName(Month(Now))        ' Displays: "October"
        MsgBox Day(Now)                     ' Displays: "29"
        MsgBox WeekdayName(Weekday(Now))    ' Displays: "Sunday"
        MsgBox Year(Now)                    ' Displays: "2000"
        MsgBox Hour(Now)                    ' Displays: "10"
        MsgBox Minute(Now)                  ' Displays: "57"
        MsgBox Second(Now)                  ' Displays: "30"
    These functions work with any Date data type. Don't know if they're useful to you for what you're doing, but they are good to know. You can do more with the Format function that TheOnly suggested.
    ~seaweed

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