![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Node.js β util.types.isDate() Method
The util.types.isDate() method checks whether the passed value is a built-in Date instance or not. If the above condition is satisfied, it returns True, else False.
Syntax
util.types.isDate(value)
Parameters
It takes a single parameter −
value − This input value takes input for the required parameter and checks if it's a Date instance or not.
It returns True or False based upon the input value passed.
Example 1
Create a file with the name "isDate.js" and copy the following code snippet. After creating the file, use the command "node isDate.js" to run this code.
// util.types.isDate() Demo Example // Importing the util module const util = require('util'); let date = new Date(); // Passing Date instance console.log("1." + util.types.isDate(date));
Output
C:\home
ode>> node isDate.js 1.true
Example 2
Let’s have a look at one more example
// util.types.isDate() Demo Example // Importing the util module const util = require('util'); let customDate = new Date('December 17, 1995 03:24:00') let customDate1 = new Date('1995-12-17T03:24:00') let customDate2 = new Date(1995, 11, 17) let customDate3 = new Date(1995, 11, 17, 3, 24, 0) // Passing epoch time in millis let customDate4 = new Date(628021800000) // Passing different Date instances console.log("1." + util.types.isDate(customDate)); console.log("2." + util.types.isDate(customDate1)); console.log("3." + util.types.isDate(customDate2)); console.log("4." + util.types.isDate(customDate3)); console.log("5." + util.types.isDate(customDate4));
Output
C:\home
ode>> node isDate.js 1.true 2.true 3.true 4.true 5.true
Advertisements