Saving filename using current month year

15 views
Skip to first unread message

Matthew Hirsch

unread,
Jan 24, 2021, 1:03:24 PM1/24/21
to mapi...@googlegroups.com

Is it possible to save a file using current month current year?

 

I have a script we run a couple times a month and to save the file, we have to manually save it to add in the MMYY to the filename.   

 

Commit Table Query1 As "M: \ZCR_Jan21.TAB" TYPE NATIVE Charset "WindowsLatin1" Interactive

 

I’d like to somehow change it to    Commit Table Query1 As "M: \ZCR_”+ curdate()+”.tab”" TYPE NATIVE Charset "WindowsLatin1" Interactive.    I know this is not right, but that is what I’d like to end up with if possible.

 

Regards,

Matthew Hirsch

 

David Reid

unread,
Jan 24, 2021, 1:26:26 PM1/24/21
to mapi...@googlegroups.com

Hello Matthew,

When I have major updates to my street centerlines I like to make backup copies prior to these updates and use a file name like “BAK_[YEAR]_[DAY]_[DATE]_[TIME]”.

 

I accomplish this with:

 

  Dim d_today As Date,

    sDate As String

  Dim s_time As String

    s_time = Time(24)

 

    d_today=CurDate()

    sDate = Year(d_today) &"-"& Right$("00" + Month(d_today), 2) &"-"& Right$("00" + Day(d_today), 2) &"_"& Left$(s_time,2) & Mid$(s_time,4,2) & Right$(s_time,2)

    '**Formats the filename like YYYY-MM-DD_HHMMSS

 

    Commit Table Streets As

            'Save the streets backup table with the prefix "BAK_"

            "[PATH TO MY BACKUP FILES]\BAK_" & sDate

            TYPE NATIVE Charset "WindowsLatin1"

 

This is easily modified to the date format or level you’d like.

 

Hope that’s some help,

Dave

--
--
You received this message because you are subscribed to the
Google Groups "MapInfo-L" group.To post a message to this group, send
email to mapi...@googlegroups.com
To unsubscribe from this group, go to:
http://groups.google.com/group/mapinfo-l/subscribe?hl=en
For more options, information and links to MapInfo resources (searching
archives, feature requests, to visit our Wiki, visit the Welcome page at
http://groups.google.com/group/mapinfo-l?hl=en

---
You received this message because you are subscribed to the Google Groups "MapInfo-L" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapinfo-l+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mapinfo-l/38f5ef7eb80b4ff682106a370829546c%40lmsg.co.


Virus-free. www.avg.com
Reply all
Reply to author
Forward
0 new messages