Forums before death by AOL, social media and spammers... "We can't have nice things"
|    alt.msdos.batch.nt    |    Fun with Windows NT batch files    |    68,980 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 67,715 of 68,980    |
|    Saucer Man to Fin Tres Nueve Dos    |
|    Re: Setting System Time N Hours Back    |
|    24 Jan 21 15:46:22    |
   
   From: saucerman@nospam.net   
      
   On 1/24/2021 2:13 PM, Fin Tres Nueve Dos wrote:   
   > El domingo, 24 de enero de 2021 a las 13:23:17 UTC+1, JJ escribió:   
   >> On Sat, 23 Jan 2021 12:17:28 -0500, Saucer Man wrote:   
   >>> I'm looking to set the system time back a certain number of hours.   
   >>> Would anyone know how to do that in a batch file?   
   >> Yes, but it'll depend on your date and time format.   
   >   
   > Check this. It is not depending on date and time format   
   >   
   > :: Example of using the function   
   > @ECHO OFF & SETLOCAL   
   >   
   > CALL :GetLocalDateTime CurrentTime   
   >   
   > ECHO Current date and time is [%CurrentTime%]   
   >   
   > ENDLOCAL & EXIT /B 0   
   >   
   >   
   > ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::   
   ::::::::::::::::   
   > ::   
   > :: Return local date and time with format 'yyyymmddhhmmss.ffffff+mmm'.   
   > ::   
   > :: Rear '+mmm' is the UTC time offsets in minutes.   
   > ::   
   > :GetLocalDateTime {Return_variable}   
   >   
   > FOR /F "tokens=1* delims==" %%a IN ('wmic OS GET LocalDateTime /VALUE ^|   
   find "="') DO SET "%~1=%%b"   
   >   
   > EXIT /B 0   
   > ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::   
   ::::::::::::::::   
   >   
   Thanks. I see it is returning the correct time and UTC offset. If I   
   wanted to set the system time back 4 hours for example, how would I use it?   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca