home bbs files messages ]

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,505 of 68,980   
   dr.j.r.stockton@gmail.com to asya...@gmail.com   
   Re: Batch Script Yesterday date file for   
   18 Mar 20 04:06:54   
   
   On Wednesday, 18 March 2020 04:42:03 UTC, asya...@gmail.com  wrote:   
      
   > i am new for batch script language.   
   > can anyone help me to get yesterday date,   
   > in below code from the date i am doing minus 1 to get yesterday date but its   
   coming wrong when 1st date of each months, its giving dd 00 how we can handle   
   this scenario   
   >    
   > i need the format always like yyyymmdd 20200301   
       
      
      
   If you know anything of either Windows Scripting or JavaScript, the simplest   
   way is probably to use one of them at boot time and store the result in an   
   environment variable (the latter you should probably do anyway, daily or   
   whenever the hour changes).   
      
   To avoid dependence on display date format, call WMIC from Batch to get the   
   current full date-time and the offset from UTC.  Then select the part you want   
   and use 'set /a' to do the necessary subtractions from day, month?, year??    
   You will need to    
   determine the length of February, but only when today is March 1st.   
      
   --    
     (c) John Stockton, near London, UK.  Using Google Groups.           |   
    Mail: J.R.""""""""@physics.org - or as Reply-To, if any.             |   
      
   --- 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