Consulting

Results 1 to 4 of 4

Thread: how to get today's date in text format?

  1. #1
    VBAX Regular
    Joined
    Jun 2007
    Posts
    27
    Location

    how to get today's date in text format?

    I want today's date showing in a textbox like
    6/27/2007.
    How can i do that?
    Thanks

  2. #2
    Knowledge Base Approver
    The King of Overkill!
    VBAX Master
    Joined
    Jul 2004
    Location
    Rochester, NY
    Posts
    1,727
    Location
    Hi Jeff,[vba]Format(Date, "m/d/yyyy")[/vba]
    Matt

  3. #3
    VBAX Regular
    Joined
    Jun 2007
    Posts
    27
    Location
    Thank you very much, Matt!

  4. #4
    VBAX Expert mperrah's Avatar
    Joined
    Mar 2005
    Posts
    744
    Location

    Also in formulas

    If you wanted to type a formula in a cell in the worksheet
    instead of vb you could use (although of course vb is so totaly awsome):
    =text(today(), "m/dd/yyyy")
    the text formula is used as text(value, "format_text")
    format being:
    d = single digit for day (7)
    dd = leading zero for day (07)
    ddd = three letter name of day (Mon)
    dddd = full name (Monday)
    m = single digit month (6)
    mm = leading zero on month (06)
    mmm = three digit name of month (Jun)
    mmmm = full name (June)
    y or yy = leading zero year (07)
    yyy or yyyy = full year in numbers (2007)


    I saw this was solved but
    I just used this recently thought to put it out there.

    Where I have today() can be substituted for a typed out date,
    or a reference to another cell, or a named cell reference.

    hope this helps

    Mark

Posting Permissions

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