
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
How to convert JS date time to MySQL datetime?
We can convert JS date time to MySQL datetime with the help of toISOString() function.
Let us see an example of JavaScript.
Example
<!DOCTYPE html> <html> <head> <title>Web Page Design</title> <script> document.writeln(new Date().toISOString().slice(0, 19).replace('T', ' ')); </script> </head> <body> <br>Current Date is displayed above... </body> </html>
Output
The following is the output.
2018-11-23 11:14:38 Current Date is displayed above...
- Related Articles
- MySQL Query to convert from datetime to date?
- How to part DATE and TIME from DATETIME in MySQL?
- How to convert JavaScript datetime to MySQL datetime?
- How to convert date to datetime in Python?
- How to compare DateTime Column with only Date not time in MySQL?
- Add DATE and TIME fields to get DATETIME field in MySQL?
- Create DATETIME from DATE and TIME in MySQL?
- How to Convert yyyymmddhhmmss Date Format to Normal Datetime in Excel?Datetime in Excel?
- How can we convert TIME and DATETIME values to numeric form in MySQL?
- How to convert MySQL datetime to Unix timestamp?
- How to convert timestamp to datetime in MySQL?
- How to combine date and time from different MySQL columns to compare with the entire DateTime?
- How to convert Python date string mm/dd/yyyy to datetime?
- How to split the datetime column into date and time and compare individually in MySQL?
- How to convert DateTime to a number in MySQL?

Advertisements