Advertisement
Virajsinh

Current DataTime JavaScript DD_MM_YYYY_HH_MM_SS in Chrome Console

May 30th, 2023
1,132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 0.24 KB | Source Code | 0 0
  1. const dt = new Date();
  2. const padL = (nr, len = 2, chr = `0`) => `${nr}`.padStart(2, chr);
  3. console.log(`${padL(dt.getDate())}_${padL(dt.getMonth()+1)}_${dt.getFullYear()}_${padL(dt.getHours())}_${padL(dt.getMinutes())}_${padL(dt.getSeconds())}` );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement