
- Python 3 Basic Tutorial
- Python 3 - Home
- What is New in Python 3
- Python 3 - Overview
- Python 3 - Environment Setup
- Python 3 - Basic Syntax
- Python 3 - Variable Types
- Python 3 - Basic Operators
- Python 3 - Decision Making
- Python 3 - Loops
- Python 3 - Numbers
- Python 3 - Strings
- Python 3 - Lists
- Python 3 - Tuples
- Python 3 - Dictionary
- Python 3 - Date & Time
- Python 3 - Functions
- Python 3 - Modules
- Python 3 - Files I/O
- Python 3 - Exceptions
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 Articles
- How to convert JavaScript datetime to MySQL datetime?
- How to compare DateTime Column with only Date not time in MySQL?
- Compare DATE string with string from MySQL DATETIME field?
- 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 combine date and time from different MySQL columns to compare with the entire DateTime?
- How to convert date to datetime in Python?
- How to Convert Text Datetime Format to Real Datetime Format in Excel?
- How to update date of datetime field with MySQL?
- Working with DateTime in C#
- Python program to display various datetime formats
- How to Convert yyyymmddhhmmss Date Format to Normal Datetime in Excel?Datetime in Excel?
- How to convert timestamp string to datetime object in Python?
- How to convert MySQL DATETIME value to JSON format in JavaScript?

Advertisements