@joefallon/mysql-date
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

mysql-date.js

An easy to use utility for converting to and from MySQL formatted date-time strings and JS Date objects. It is written in TypeScript.

By Joe Fallon

http-statuses has the following features:

  • Full suite of unit tests
  • Can be fully understood in just a few moments
  • Written in TypeScript

Installation

The easiest way to install mysql-date is with npm.

npm install @joefallon/mysql-date --save

Usage

import MySqlDate from 'mysql-date';

MySqlDate.toJsDate('2012-12-12 12:12:12'); //--> '2012-12-12T20:12:12.000Z'

const jsDate = new Date(2012, 12 - 1, 12, 12, 12, 12);
const mysql  = MySqlDate.toMySqlDate(jsDate); //--> '2012-12-12 12:12:12'

MySqlDate.nowMySqlDate(); //--> 2017-12-21 15:30:33

Readme

Keywords

none

Package Sidebar

Install

npm i @joefallon/mysql-date

Weekly Downloads

5

Version

0.1.2

License

MIT

Unpacked Size

16.7 kB

Total Files

13

Last publish

Collaborators

  • joefallon