Advertisement
waterlgndx

time js

Oct 17th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function getTime(objId)
  2. {
  3.     let obj = document.getElementById(objId);
  4.     let today = new Date();
  5.     let options = {day:"numeric", month:"numeric", year:"numeric",
  6.         hour12:false, hour:"numeric", minute:"numeric"};
  7.     //it'd be nice if you could specify a pattern like pattern:"{day}/{month}/{year} {hour}:{minute}"  
  8.     obj.innerHTML = new Intl.DateTimeFormat("en-GB", options).format(today);   
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement