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

day-from-1970

v1.0.0

Published

Calculate out which day, month, year and week from 1970.1.1 via one timestamp.

Downloads

3

Readme

Day From 1970

Day From 1970 Day From 1970 Build Status Coverage Status License Dependency Status

A node.js module of calculating out witch day, month, year and week from 1970.1.1 via one timestamp.

Application Scenario

When you want to GROUP data by Week, Day, Month and Year, maybe you need it.

This module allows you to pass an integer of timestamp as a parameter, and it will calculate out which day is this timestamp from 1970/01/01, which week is this timestamp from 1970/01/01, which month and even witch year.

Installation

$ npm install day-from-1970 --save

or

$ bower install day-from-1970 --save

Usage

df1970(timestamp, [timezone], [firstday]);

Timestamp above is the timestamp of one second.

The second parameter timezone is optional, which stands for the timezone (from -12 to 12). if no timezone is specified, the default value is your current timezone.

And the third parameter is opitional, which stands for the first day of one week.

1 stands for Monday and 7 stands for Sunday. And you can pass 1 ~ 7 as the second parameter.

And it will return an object like:

{
  "day": 16169,
  "week": 2311,
  "month": 532,
  "year": 45
}

So the test code is below:

var df1970 = require("day-from-1970");
var t = 1396946977;
var list = [];
for(var i = 0; i < 10; i++) {
    list.push(df1970(t));
    t += 86400;
}

console.log(list);

Thanks For

Thanks for HXJ to write the C++ version.

Contribute

If you want to contribute to this repo, you can contact me or just make pull requests: