 formatISO9075
Format the date according to the ISO 9075 standard (https://dev.mysql.com/doc/refman/5.7/en/date-and-time-functions.html#function_get-format).
Description
Return the formatted date string in ISO 9075 format. Options may be passed to control the parts and notations of the date.

Usage
// CommonJS
var formatISO9075 = require('date-fns/formatISO9075')
// ES 2015
import formatISO9075 from 'date-fns/formatISO9075'
// ESM
import { formatISO9075 } from 'date-fns'
Syntax
formatISO9075(date, [options])
Arguments


Name
Description


date
the original date



options
an object with options.



options.format
if 'basic', hide delimiters between date and time values.



options.representation
format date, time, or both.



Returns


Description


the formatted date string



Exceptions


Type
Description


TypeError
1 argument required



RangeError
date must not be Invalid Date



RangeError
options.format must be 'extended' or 'basic'



RangeError
options.representation must be 'date', 'time' or 'complete'



Examples
// Represent 18 September 2019 in ISO 9075 format:
const result = formatISO9075(new Date(2019, 8, 18, 19, 0, 52))
//=> '2019-09-18 19:00:52'
// Represent 18 September 2019 in ISO 9075, short format:
const result = formatISO9075(new Date(2019, 8, 18, 19, 0, 52), { format: 'basic' })
//=> '20190918 190052'
// Represent 18 September 2019 in ISO 9075 format, date only:
const result = formatISO9075(new Date(2019, 8, 18, 19, 0, 52), { representation: 'date' })
//=> '2019-09-18'
// Represent 18 September 2019 in ISO 9075 format, time only:
const result = formatISO9075(new Date(2019, 8, 18, 19, 0, 52), { representation: 'time' })
//=> '19:00:52'


                
{'path': 'public/docs/date_fns/formatISO9075.html', 'source': 'DevDocs.IO'}