

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to compare Python DateTime with Javascript DateTime?
The datetime in Javascript and in Python have 2 major differences. First one being the meaning of the month argument.
The month in Javascript is expected between 0-11 while in Python it is expected to be between 1-12. So the following tuple actually represents 2 different dates in Python and in Javascript −
(2017, 11, 1) Python: 1st November 2017 Javascript: 1sd December 2017
The second difference is that they have different default timezones, with Python defaulting to UTC while JavaScript defaults to the user's "local" timezone. You can use Date.UTC(), which returns the timestamp, for the equivalent in JavaScript. For example,
var utc = Date.UTC(2013, 7, 10);
- Related Questions & Answers
- Compare DATE string with string from MySQL DATETIME field?
- How to compare DateTime Column with only Date not time in MySQL?
- How to convert Python datetime to epoch with strftime?
- Convert from varchar to datetime and compare in MySQL?
- How to create a series with DateTime?
- Python Pandas - Create a datetime with DateTimeIndex
- How to convert date to datetime in Python?
- Working with DateTime in C#
- How to combine date and time from different MySQL columns to compare with the entire DateTime?
- Difference between datetime and datetime-local in HTML5
- Insert datetime into another datetime field in MySQL?
- Python program to display various datetime formats
- How to update date of datetime field with MySQL?
- C# Nullable Datetime
- How to convert Python DateTime string into integer milliseconds?
Advertisements