Code Monkey home page Code Monkey logo

date-time's Introduction

date-time

Simple date time functionalities.

Installation

Install with component(1):

$ component install tm-components/date-time

API

var DateTime = require("date-time");
...
el.innerHTML = DateTime.format("F j, Y", new Date());

DateTime.format

This function will optionally take a format string, a date object, and a locale object. The formatting options are copied/inspired from the PHP date formating function to make it easier to remember.

By default the function will return the current date with the format F j, Y.

Key Example Details
Y 2014 Year full
y 14 Year short 
F Janurary Month full name
M Jan Month short name
n 1 Month in number
m 01 Month in number with leading zeros
d 01 Day in number with leading zeros
j 1 Day in number
D Sun Day short name
l Sunday Day full name
a am Lowercase noon status
A PM Uppercase noon status
g 11 Hours in 12
G 22 Hours in 24
h 01 Hours in 12 format with leading zeros
H 09 Hours in 24 format with leading zeros
i 03 Minutes with leading zeros
I 49 Minutes
s 08 Seconds with leading zeros
S 32 Seconds

date-time's People

Contributors

tmathews avatar

Watchers

William Casarin avatar James Cloos avatar  avatar

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.