Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

como saber si una fecha es mayor que otra en javascript

var f1 = new Date(2015, 11, 31); //31 de diciembre de 2015
var f2 = new Date(2015, 11, 31, 2); //31 de diciembre de 2015 (32-12-2015 02:00 am) 

//nos aseguramos que no tengan hora
f1.setHours(0,0,0,0);
f2.setHours(0,0,0,0);

// validamos las fechas con un IF
if (f1.getTime() == f2.getTime()){
  console.log("Son la misma fecha");
}else{
  console.log("Son diferentes fechas");
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: require is undefined 
Javascript :: first letter tuUppercase 
Javascript :: javascript check if dom element exists 
Javascript :: invalid time value react datepicker 
Javascript :: discord js convert timestamp to date 
Javascript :: get status bar height react native 
Javascript :: javascript object destructuring rename 
Javascript :: geofencing javascript example 
Javascript :: timestamps in mongoose 
Javascript :: javascript check if two keys are pressed 
Javascript :: sum of numbers array using for loop in javascript 
Javascript :: how to find the index of a value in an array in javascript 
Javascript :: express async errors 
Javascript :: flattenDeep in es 6 without lodash 
Javascript :: FullScreen Image By OnClick Jquery 
Javascript :: settime out with promise 
Javascript :: bodyparser purpose 
Javascript :: chart js x axis start at 0 
Javascript :: bash commands in node 
Javascript :: clear input field react-hook-form 
Javascript :: store data in array jquery 
Javascript :: how to set current date and time in jquery datetime-local 
Javascript :: how to delete element at a particular index of array in react js 
Javascript :: find the max length of string elements in an array 
Javascript :: react how to create range 
Javascript :: history.push 
Javascript :: how to find out which version of react 
Javascript :: javascript replace text within dom 
Javascript :: check if there is page has scrollbar x js 
Javascript :: nodejs download image from url 
ADD CONTENT
Topic
Content
Source link
Name
9+1 =