npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@o2htechnology/datetime

v1.0.2

Published

```bash npm i @o2htechnology/datetime ```

Downloads

3

Readme

Install Package

npm i @o2htechnology/datetime

Usage

// import library using required
const datetime = required('@o2htechnology/datetime');

const date = new Date();

// returns DD-MM-YYYY date format
const format = datetime(date).formate('DD-MM-YYYY');

// returns day of week like Tuesday
const day = datetime(date).day();

Format options

| Format | result | | ------------------------- | ---------------------------------------------------------------- | | D | 1 2 ... 30 31 (day of month) | | DD | 1 2 ... 30 31 (2 letter of day of month) | | DDD | 1 2 ... 364 365 (day of year) | | DDDD | 001 002 ... 364 365 (day of year) | | d | 0 1 ... 5 6 (day of week) | | dd | Su Mo ... Fr Sa (2 letter day) | | dd | Sun Mon ... Fri Sat (3 letter day) | | dddd | Sunday Monday ... Friday Saturday | | M | 1 2 ... 11 12 (Month) | | MM | 01 02 ... 11 12 (Month) | | MMM | Jan Feb ... Nov Dec (Month string) | | MMMM | January February ... November December (Month string) | | y, yy, yyy, yyyy, YYYY, Y | 4 digit year | | YY | 2 digit year | | h | 1 2 ... 11 12 (12 hour) | | H | 0 1 ... 22 23 (24 hour) | | hh | 01 02 ... 11 12 (12 hour) | | HH | 00 01 ... 22 23 (24 hour) | | m | 0 1 ... 58 59 (minute) | | mm | 00 01 ... 58 59 (minute) | | s | 0 1 ... 58 59 (Second) | | ss | 00 01 ... 58 59 (Second) | | a,A | Post or ante meridiem | | x | Unix Millisecond Timestamp | | X | Unix Timestamp | | Q | 1 2 3 4 (Quarter number) | | Qo | 1st 2nd 3rd 4th (Quarter number with ordinary suffix) | | Mo | 1st 2nd ... 11th 12th (Month number with ordinary suffix) | | Do | 1st 2nd ... 30th 31st (Day of month number with ordinary suffix) | | DDDo | 1st 2nd ... 364th 365th (Day of year) | | do | 0th 1st ... 5th 6th (Day of week) | | w | 1 2 ... 52 53 (week of year) | | wo | 1st 2nd ... 52nd 53rd (week of year) | | ww | 01 02 ... 52 53 (Week of year) |

Methods

** .utc() **

datetime().utc();

.utc() is utc mode. Ambiguous input is assumed to be UTC. Unambiguous input is adjusted to UTC.

** .tz(timezone) **

e.g

datetime().tz('Asia/Kolkata');

does parsing in given time zone

** .add(amount, unit) **

Mutates the original datetime by adding time.

datetime().add(7, 'days');

unit : It is a number, which you want to add in date

| Amounts | | ------------ | | years | | quarters | | months | | weeks | | days | | hours | | minutes | | seconds | | milliseconds |