home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   alt.msdos.batch      Fun with MS-DOS batch files      42,547 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 41,468 of 42,547   
   sean to All   
   date format & time questions   
   09 Oct 16 05:15:24   
   
   From: sean@sean.eternal-september.org   
      
   Hi All,   
      
   So I don't really care for the way Windows sets dates and therefore, I   
   have this set in my scripts:   
   SET _DATE=%date:~10,4%%date:~4,2%%date:~7,2%   
      
   However, I'd like to know how I can have dashes in between the numerics.   
   My experimentation didn't result in anything working.   
      
   current:   
   20161008   
      
   preferred:   
   2016-10-08   
      
      
   Second question...   
      
   In another script I have these set:   
   SET _DATE=%date:~10,4%%date:~4,2%%date:~7,2%   
   set _time=%TIME:~0,2%:%TIME:~3,2%:%TIME:~6,2%   
   set _minute=%TIME:~3,2%   
      
   The script saves results like this: >> %_date%-%_minute%-results.txt   
      
   I determined I needed to add the minute variable because the server time   
   and client time are different (local vs. UTC)   
      
   If I attempt to use %_time%, I get this error:   
   5:12:12-results.txt was unexpected at this time.   
      
   Am I stuck to relying on my minute variable or can it really save   
   results.txt in UTC time?   
      
   Thanks,   
   sean   
      
   --- 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