Day 98: Compare Two Dates of 100DaysCodingChallenge

Hello all, 

#day98 

Day98 

Today's my task was to Write a Program to Compare the Two Dates.

I have started the 100 days of coding challenge to improve my programming skills..

Code : 

// program to compare value of two dates
// create two dates
const d1 = new Date();
const d2 = new Date();

console.log(d1);
console.log(d2);

// comparisons
const compare1 = d1 < d2;
console.log(compare1);

const compare2 = d1 > d2;
console.log(compare2);

const compare3 = d1 <= d2;
console.log(compare3);

const compare4 = d1 >= d2;
console.log(compare4);

const compare5 = d1.getTime() === d2.getTime();
console.log(compare5);

const compare6 = d1.getTime() !== d2.getTime();
console.log(compare6);


Output :     

 




Happy Coding:)

Thank you...      

Comments

Popular posts from this blog

Day 55: Pattern using loops of 100DaysCodingChallenge

Day 7: Square or Power Integer Numbers of 100DaysCodingChallenge

Day 45: Pattern using loops of 100DaysCodingChallenge