Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for sorttime.js

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

  1. // SortTime.js,  Version 1.00 for Windows Script Host 1.00
  2. // Show current time in HHmmss format
  3. // Written by Rob van der Woude
  4. // http://www.robvanderwoude.com
  5.  
  6. // Get and parse current time
  7. now     = new Date();
  8. hours   = now.getHours();
  9. minutes = now.getMinutes();
  10. seconds = now.getSeconds();
  11.  
  12. // Add leading spaces if necessary
  13. if ( hours   < 10 ) hours   = "0" + hours;
  14. if ( minutes < 10 ) minutes = "0" + minutes;
  15. if ( seconds < 10 ) seconds = "0" + seconds;
  16.  
  17. // Concatenate strings and display the result
  18. WScript.Echo( "SortTime=" + hours + "" + minutes + "" + seconds );
  19.  

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