Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MKDIR Command with date stamp for folder name

Status
Not open for further replies.

boxplan

MIS
Oct 12, 1999
78
US
I would like to use the MkDIR command to create a directory with a name that is a date stamp. How do I retrieve the date (now) from the system and return it as a string that I can use with MkDir?

(New to VB!!)

Thanks in advance,
 
Format(Now(), "mm-dd-yy") is one way.

You can get Format to return many different styles of date strings. Look up the Format function in the help file, then click See Also and choose "User-defined date/time formats". Rick Sprague
 
Thanks RickSpr,

I'm not clear on how to get to become the directory name created with MkDir.
 
Format() returns a string. Save the string in a variable. Use the variable name as part of the argument to MkDir. For example:
strTodaysDate = Format(Now(), "mm-dd-yy")
MkDir CurDir & "\" & strTodaysDate
If you ran this today while your current directory was C:\My Documents, it would create a directory C:\My Documents\03-17-01. Rick Sprague
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top