• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 272
  • Last Modified:

Assign today's date to a variable using VB Script

Experts,

I have a VB script that i am currently running to copy files from one folder to another. I would like to assign today's date to  variable tday.

I would then like to make a concatatenated variable of the date to be:

YYMMDD   thus today would be 140304

How would I do this in my script.

 I am having a problem just assigning today's date for some reason.  I am running in Windows 7.
0
morinia
Asked:
morinia
1 Solution
 
MacroShadowCommented:
Try this:
strDate = Format(Date, "YYMMDD")

Open in new window

0
 
moriniaAdvanced Analytics AnalystAuthor Commented:
This gives me a type format error
0
 
GaryCommented:
tday = year(date) & Right(String(2, "0") & Month(date), 2) & Right(String(2, "0") & Day(date), 2)

Open in new window

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now