Every line of 'html today's date' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your JavaScript code is secure.
43 function getToday(){ 44 var date = new Date() 45 var day = pad(date.getDate()) 46 var month = pad((date.getMonth()+1)) 47 var year = date.getFullYear() 48 return month + '/' + day + '/' + year 49 }
235 function formatTodayDate () { 236 const date = new Date(); 237 const day = ('0' + date.getDate()).slice(-2); 238 const month = ('0' + (date.getMonth() + 1)).slice(-2); 239 const year = date.getFullYear(); 240 241 return `${year}-${month}-${day}`; 242 }
6 function getToday() { 7 var now = new Date(); 8 now.setHours(0); 9 now.setMinutes(0); 10 now.setSeconds(0); 11 now.setMilliseconds(0); 12 return now; 13 }
22 function createYesterdayString() { 23 var yesterday = new Date(); 24 yesterday.setDate(yesterday.getDate() - 1); 25 return formatDate(yesterday); 26 }
86 function getDate(date) { 87 var yyyy = date.getFullYear().toString(); 88 var mm = (date.getMonth() + 1).toString(); 89 var dd = date.getDate().toString(); 90 91 return (dd[1] ? dd : "0" + dd[0]) + "." + (mm[1] ? mm : "0" + mm[0]) + "." + yyyy; 92 }
5 export function dayStart(date) { 6 const now = date || new Date(); 7 return setTime(now); 8 }
90 function longdate(date, showtime) { 91 return format_date(date, months, showtime) 92 }
24 function formatDay(date) { 25 d = new Date(date * 1000); 26 return d.getDate() + " " + months[d.getMonth()]; 27 }
37 function getDate(strDate) { 38 /* istanbul ignore next */ 39 return moment(strDate).format('YYYY-MM-DD') 40 }
19 function getDate() { 20 // GET CURRENT DATE 21 var date = new Date(); 22 23 // GET YYYY, MM AND DD FROM THE DATE OBJECT 24 var yyyy = date.getFullYear().toString(); 25 var mm = (date.getMonth()+1).toString(); 26 var dd = date.getDate().toString(); 27 28 // CONVERT mm AND dd INTO chars 29 var mmChars = mm.split(''); 30 var ddChars = dd.split(''); 31 32 // CONCAT THE STRINGS IN YYYY-MM-DD FORMAT 33 var datestring = yyyy + '-' + (mmChars[1]?mm:"0"+mmChars[0]) + '-' + (ddChars[1]?dd:"0"+ddChars[0]); 34 35 return datestring ; 36 }