Code Monkey home page Code Monkey logo

js-ntformat's Introduction

NTFormat

MIT License

Install

npm install --save-dev ntformat

Use

import NTFormat from "ntformat";

Exsample

> console.log(NTFormat.textf("%03d %1.3f %04X %e", 1, 1 / 3, 0xbeaf, 100000000));
001 0.333 BEAF 1.000000e+008

> console.log(NTFormat.textf("[%3$d %2$d %1$d]", 1, 2, 3));
[3 2 1]

> console.log(NTFormat.datef("YYYY/MM/DD hh:mm:ss", new Date("2023/1/20 12:34:56")));
2023/01/20 12:34:56

> console.log(
> 	NTFormat.datef("YYYY-MM-DDThh:mm:sszzzzzz", new Date("2023-01-23T12:34:56+02:00"), {
> 		timezone_minutes: 9 * 60
> 	})
> );
2023-01-23T19:34:56+09:00

> console.log(
> 	NTFormat.datef("YYYY-MM-DDThh:mm:ssZ", new Date("2023-01-23T12:34:56+02:00"), {
> 		is_utc: true
> 	})
> );
2023-01-23T10:34:56Z

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.