Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for sortdate.js

(view source code of sortdate.js as plain text)

  1. // SortDate.js,  Version 1.00 for Windows Script Host 1.00
  2. // Show current date in YYYYMMDD format
  3. // Written by Rob van der Woude
  4. // http://www.robvanderwoude.com
  5.  
  6. // Get and parse current date
  7. now   = new Date();
  8. day   = now.getDate();
  9. month = now.getMonth() + 1;
  10. year  = now.getYear();
  11.  
  12. // Add leading spaces if necessary
  13. if ( day   < 10 ) day   = "0" + day;
  14. if ( month < 10 ) month = "0" + month;
  15.  
  16. // Concatenate strings and display the result
  17. WScript.Echo( "SortDate=" + year + "" + month + "" + day );
  18.  

page last modified: 2024-04-16; loaded in 0.0046 seconds