Results 1 to 13 of 13
  1. #1
    2 Star Lounger
    Join Date
    Mar 2002
    Posts
    164
    Thanks
    0
    Thanked 0 Times in 0 Posts

    append date/time to filename (2003)

    I'm trying to also add a timestamp to my file. At the moment, I'm just appending the date to the filename. Is this possible?

    ="nt05643cInvoices - " & Format(Date(),"yyyymmdd") & ".rtf"

  2. #2
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: append date/time to filename (2003)

    This should be possible. Where do you use this expression?

  3. #3
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: append date/time to filename (2003)

    If you want to include the time, use Now instead of Date, and extend the format string:

    ="nt05643cInvoices - " & Format(Now(),"yyyymmddhhmmss") & ".rtf"

  4. #4
    2 Star Lounger
    Join Date
    Mar 2002
    Posts
    164
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: append date/time to filename (2003)

    It's in OutputFile of my macro.

  5. #5
    Platinum Lounger
    Join Date
    Dec 2001
    Location
    Melbourne, Australia
    Posts
    4,594
    Thanks
    0
    Thanked 27 Times in 27 Posts

    Re: append date/time to filename (2003)

    Should the yyyymmddhhmmss by yyyymmddhhnnss ?

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: append date/time to filename (2003)

    Officially, yes, but the result is the same. VBA is smart enough to understand that hhmmss is a time format <img src=/S/smile.gif border=0 alt=smile width=15 height=15>

  7. #7
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: append date/time to filename (2003)

    But not smart enough to realize yyyymmdd is a date? <img src=/S/sad.gif border=0 alt=sad width=15 height=15>
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  8. #8
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: append date/time to filename (2003)

    What do you mean?

  9. #9
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: append date/time to filename (2003)

    Ah, but it isn't a date, it's a custom format. What are you trying to do with it?
    Charlotte

  10. #10
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: append date/time to filename (2003)

    I have fields formatted to yyyymmdd, but I have to input them in English formats (mm/dd/yy, dd/mmm/yy, etc). It's just a small inconvenience, and confusing for new data entry clerks.
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  11. #11
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: append date/time to filename (2003)

    A format such as yyyymmdd cannot be used as an input format, since it is ambiguous:

    11041208 could be:

    yyyymmdd: December 8, 1104
    yyyyddmm: August 12, 1104
    ddmmyyyy: April 11, 1208
    mmddyyyy: November 4, 1208

  12. #12
    5 Star Lounger
    Join Date
    Nov 2004
    Location
    Wilmington, North Carolina, USA
    Posts
    1,196
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: append date/time to filename (2003)

    11/12/06 could be 11 dec 06 or 12 nov 06... <img src=/S/hmmn.gif border=0 alt=hmmn width=15 height=15>
    ____________________________
    Jeremy
    "If you spend more on coffee than on IT security, then you will be hacked. What&#39;s more, you deserve to be hacked." -Richard Clarke

  13. #13
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: append date/time to filename (2003)

    Yes, but that is determined by your system date settings. The problem is that yyyymmdd does not conform to the system date format, nor does it contain separators to help parsing the input.

Posting Permissions

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