What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-09-04 22:51:02
js datetime format
var options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' }; var today = new Date(); console.log(today.toLocaleDateString("en-US")); // 9/17/2016 console.log(today.toLocaleDateString("en-US", options)); // Satur... Add solution -
Javascript 2021-09-01 12:09:02
date of birth validation for 18 years javascript
function isOver18(dateOfBirth) { // find the date 18 years ago const date18YrsAgo = new Date(); date18YrsAgo.setFullYear(date18YrsAgo.getFullYear() - 18); // check if the date of birth is before that date return dateOfBirth <= date18YrsAgo; }... Add solution -
Javascript 2021-08-30 05:58:03
new date javascript
var d= new Date(); d.getFullYear(); //Get the year as a four digit number (yyyy) d.getMonth(); //Get the month as a number (0-11) d.getDate(); //Get the day as a number (1-31) d.getHours(); //Get the hour (0-23) d.getMinutes(); //Get the minute (0-59) d.g... Add solution -
Javascript 2021-08-29 14:29:02
jest serializes to the same string
describe("toDate", () => { it("should accept times", () => { const dateTime = new Date(); dateTime.setHours(0); dateTime.setMinutes(30); dateTime.setSeconds(0, 0); // error: serializes to same string ... Add solution -