Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Sascha Manns
Added: Jul 4, 2018 8:41 PM
Views: 13
Tags: no tags
Returns time in format hh:m
  1. var date = new Date();
  2.    
  3. var hour = String(date.getHours());
  4. var minutes = String(date.getMinutes());
  5.  
  6. if (minutes.length < 2)
  7.     minutes = '0' + minutes;
  8.        
  9. return hour + ':' + minutes;