strftime-format
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

strftime-format

Takes in a Date object and a string and replaces all strftime C-type time variables in the string with the corresponding data from the Date object.

Installation

yarn add strftime-format

Syntax

strftimeFormat(date, string);
strftimeFormat(date, string, locale);

Parameters

date

A Date object

string

A string containing strftime C-type time variables. List of supported variables here: https://strftime.org/

locale (optional)

A locale string

Example

import strftimeFormat from 'strftime-format';

const date = new Date();

const dateString = strftimeFormat(date, '%A %-d. %B, %Y');
const germanDateString = strftimeFormat(date, '%A %-d. %B, %Y', 'de-DE');

Readme

Keywords

none

Package Sidebar

Install

npm i strftime-format

Weekly Downloads

14

Version

1.0.3

License

MIT

Unpacked Size

10.1 kB

Total Files

15

Last publish

Collaborators

  • iamlowlikeyou