# date-utils-format

> A simple date converter with format options

Latest version **0.2.0** (published 2023-05-15) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install date-utils-format
pnpm add date-utils-format
yarn add date-utils-format
bun add date-utils-format
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2023-05-15 |
| First published | 2022-10-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6.0.0 |
| Dependencies | 0 |
| Unpacked size | 17.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | ItsLeon15 |
| Maintainers | itsleon |
| Keywords | date, converter, format, time |

## Links

- npm: https://www.npmjs.com/package/date-utils-format
- Repository: https://github.com/ItsLeon15/date-converter
- Issues: https://github.com/ItsLeon15/date-converter/issues
- npm.io page: https://npm.io/package/date-utils-format

## Alternatives

- [@js-joda/timezone](https://npm.io/package/@js-joda/timezone.md) — 383.4K weekly downloads
- [chartjs-adapter-moment](https://npm.io/package/chartjs-adapter-moment.md) — 210.8K weekly downloads
- [strftime](https://npm.io/package/strftime.md) — 171.2K weekly downloads
- [vue-flatpickr-component](https://npm.io/package/vue-flatpickr-component.md) — 115.8K weekly downloads
- [timepicker](https://npm.io/package/timepicker.md) — 51.0K weekly downloads

## Recent versions

- 0.2.0 (latest) — 2023-05-15
- 0.1.7 — 2022-10-14
- 0.1.6 — 2022-10-07
- 0.1.5 — 2022-10-06
- 0.1.4 — 2022-10-05
- 0.1.3 — 2022-10-05
- 0.1.1 — 2022-10-05

## README

# Date Converter

> Date Converter is a simple package which is meant for changing dates into a new format. It supports different date seperators as well as timestamps.

## Prerequisites

This project requires NodeJS (version 6 or later) and NPM.
[Node](http://nodejs.org/) and [NPM](https://npmjs.org/) are really easy to install.
To make sure you have them available on your machine,
try running the following command.

```sh
$ npm -v && node -v
6.4.1
v8.16.0
```

## Installation
Run the following command to get the latest version package
```
npm install --save date-utils-format
```
### Import the package
```
import converter from 'date-utils-format';
```
## Usage
### Transform Date
Use the transformDate function to quickly transform a given date to another format such as below where it is being changed to ``'dd/MM/yyyy'`` from ``'YYYY-MM-DD'``. Please note that it doesn't matter if the ``'YYYY-MM-DD'`` is upper or lowcase.
```
converter.transformDate('2022-10-05', 'YYYY-MM-DD, 'dd/MM/yyyy')
```
### Get Date
To get the current date you can use the following command. You have the option to choose either ``date``, ``time``, ``datetime`` or ``timestamp``. Examples of all of the following are below.
```
const date = converter.getDate('date', '-');
const time = converter.getDate('time', ':');
const datetime = converter.getDate('datetime', '-');
const timestamp = converter.getDate('timestamp');
```
The result will be the following from ``date``, ``time``, ``datetime`` and then ``timestamp`` in that order.
```
05-10-2022
15:12:52
05-10-2022 15-12-52
1664979172769
```

---
_Source: https://npm.io/package/date-utils-format · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
