Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. class GetCurrentDate {
  2. constructor(_day, _month, _year) {
  3. this.day = _day;
  4. this.month = _month;
  5. this.year = _year;
  6. }
  7.  
  8. display() {
  9. // set date to the html element
  10. document.getElementById('date_wg').innerHTML = `${this.day}/${this.month}/${this.year}`;
  11. }
  12. }
  13.  
  14.  
  15. let today = new Date();
  16. let dd = String(today.getDate()).padStart(2, 0);
  17. let mm = String(today.getMonth() + 1).padStart(2, 0);
  18. let yyyy = today.getFullYear();
  19.  
  20.  
  21. currDate = new GetCurrentDate(dd, mm, yyyy);
  22. currDate.display();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement