MCT Posted November 26, 2004 Share Posted November 26, 2004 how can i set the date to 01\01\03 then back to the date its sposed 2 be? (like todays date or whatever)thanks Link to comment Share on other sites More sharing options...
maxXPsoft Posted November 26, 2004 Share Posted November 26, 2004 Command PromptSyntax: date [mm-dd-yy]Try first date /? Link to comment Share on other sites More sharing options...
MCT Posted November 26, 2004 Author Share Posted November 26, 2004 yes i know, but how do i "keep" todays date? maybe as a variable? so i can set it back Link to comment Share on other sites More sharing options...
maxXPsoft Posted November 26, 2004 Share Posted November 26, 2004 Yes you can but have to strip out the Weekdaydate /t>DateNow.txtReturns Thu 11/25/2004Or do it in a variable Link to comment Share on other sites More sharing options...
Vel Straty Posted November 26, 2004 Share Posted November 26, 2004 To get the todays date as a file, you can use this,echo %DATE:~0,10% > c:\DATENOW.txtThen you'll get today's date as a file.And when you want the date BACK again,simply do DATE < c:\DATENOW.txtThis 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 More sharing options...
MCT Posted November 26, 2004 Author Share Posted November 26, 2004 ill give this a try, thanks Link to comment Share on other sites More sharing options...
MCT Posted November 26, 2004 Author Share Posted November 26, 2004 i cant get it 2 import the date again :s your command isnt working 4 meit complains about the date format Link to comment Share on other sites More sharing options...
MCT Posted November 26, 2004 Author Share Posted November 26, 2004 double post Link to comment Share on other sites More sharing options...
nakira Posted November 26, 2004 Share Posted November 26, 2004 Here's an example...@echo offset realdate=%date:~4%date 01/01/03date /tdate %realdate%date /t Link to comment Share on other sites More sharing options...
MCT Posted November 26, 2004 Author Share Posted November 26, 2004 awesome man that works. thanks Link to comment Share on other sites More sharing options...
Vel Straty Posted November 26, 2004 Share Posted November 26, 2004 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 More sharing options...
edmoncu Posted November 26, 2004 Share Posted November 26, 2004 i've got a similar problem (but setting only the year) and i was able to find a way on circumventing it. hope it helps. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now