Jump to content

set date then back again


MCT

Recommended Posts


To get the todays date as a file, you can use this,

echo %DATE:~0,10% > c:\DATENOW.txt

Then you'll get today's date as a file.

And when you want the date BACK again,

simply do

DATE < c:\DATENOW.txt

This works for me!

If you only want the YEAR,

echo %DATE:~0,4%

If you only want the MONTH,

%DATE:~5,2%

If you only want the DAY,

echo %DATE:~8,3%

Change the parameters to fit your needs!

Link to comment
Share on other sites

whmm, I wonder why it didin't work for you.

But I guess nakira's way is a lot easier and doesn't fiddle around with making files.

My way is another way but can work for other other batch files other than the one it made. Although, I don't think a DATE stuff would e needed any longer than 24 hours! Try it for the TIME method if one needs it. GreenMachine @ EXCREATE forum is better at handling those kinds of things so ask him when he's got time.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...