1.0.9 • Published 1 year ago

convert-date-format v1.0.9

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
1 year ago

General

With this package it is possible to display a date in a given Format.

Only give the date as string, Object or Date() and as second param the output format

Date

Valid Params as:

- String like "15.04.2022" or "15.04.22 15:07:30"
- Object
    - {year: 2022, month: 12, day: 5}
    - {year: 2022, month: 12, day: 5, hour: 15, minutes: 12, second: 11}
- Any Valid Date like new Date()

Format

mask for:

- yyyy = year
- yy = year only last 2 digits
- mm = Month
- dd = Day
- H  = Hour
- i  = Minutes
- s  = Seconds

example

"dd.mm.yyyy" | 15.04.2023
"mm.yyyy" | 12.2023
"yy-mm-dd" 23-12-20
"H:i"   12:30

Delimiter

- It is your choice which delitmeter you want to use place it into the Format string

Import

Use the following command to import:

import dateFormat from 'convert-date-format/index'

Use

Use Import the following command to paste:

return dateFormat(new Date(),"yyyy-mm-dd H:i:s")
return dateFormat("12.05.2022 15:00:25","yyyy-mm-dd H:i:s")
return dateFormat({"year": 2022, "month": 3, "day":15 },"yyyy-mm-dd H:i:s")
return dateFormat({"year": 2022, "month": 3, "day":15, "hour": 14, "minutes": 25, "second": 35 },"yyyy-mm-dd H:i:s")


"invalid for full date you have give all params like above"
return dateFormat({"year": 2022, "month": 3, "day":15, "hour": 14, "minutes": 25 },"yyyy-mm-dd H:i:s"))
1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago