title: Safe way to get current day month and year in batch
body: <p>I am trying to write a batch script that will get the current day, month and year in a safe manner(i.e. independent of the date format). Unfortunately all the internet sources I have found propose something like:</p>
  
  <pre><code>   SET CURRENT_DATE=%DATE: =0%
     SET YEAR=%DATE:~-4%
     SET MONTH=%DATE:~3,2%
     SET DAY=%DATE:~5,2%
  </code></pre>
  
  <p>This will work if my date is in format yyyy/mm/dd or yyyy-mm-dd but will not if it is in format yy-mm-dd or some other format. Is there a safe way to get the year, month and day?</p>
  
  <p>And one more question - is it possible to know what the day separator is(<code>/</code> in the first case and <code>-</code> in the other cases). </p>