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

discstamp

v1.1.21

Published

Timestamp to discord timestamp converter

Downloads

16

Readme

Installation

To install discstamp, use npm:

npm install discstamp

Usage

Using discstamp is incredibly straightforward. This section provides you with detailed examples on how to convert various timestamp formats to Discord UNIX timestamps.

Basic Example

Let's begin with a simple example using an ISO 8601 timestamp. Simply import the discstamp module and call the iso function with the timestamp you want to convert:

const discstamp = require('discstamp');

const isoTimestamp = '2023-08-27T19:45:00';
const discordTimestampFromIso = discstamp.iso(isoTimestamp);
console.log(discordTimestampFromIso);

AM/PM Format

You can also convert timestamps in the AM/PM format. Provide the time along with the period (AM/PM), followed by the timezone to the ampm function:

const discstamp = require('discstamp');
const amPmTimestampWithTimezone = '08:30 AM EST';
const discordTimestampFromAmPm = discstamp.ampm(amPmTimestampWithTimezone);
console.log(discordTimestampFromAmPm);

Supported Timezones

Many timezones are supported, some of them, with their code are listed below:

American Timezones

| Timezone Name | Timezone Code | Offset | |-----------------------------------|---------------|-----------| | Eastern Standard Time | EST | UTC-5 | | Central Standard Time | CST | UTC-6 | | Mountain Standard Time | MST | UTC-7 | | Pacific Standard Time | PST | UTC-8 | | Alaska Standard Time | AKST | UTC-9 | | Hawaii-Aleutian Standard Time | HST | UTC-10 | | Brasília Time | BRT | UTC-3 | | Argentina Time | ART | UTC-3 |

European Timezones

| Timezone Name | Timezone Code | Offset | |-----------------------------------|---------------|-----------| | Central European Time | CET | UTC+1 | | Eastern European Time | EET | UTC+2 | | Western European Time | WET | UTC+0 | | Irish Standard Time | IST | UTC+0 | | Greenwich Mean Time | GMT | UTC+0 | | Coordinated Universal Time | UTC | UTC+0 | | British Summer Time | BST | UTC+1 | | Central European Summer Time | CEST | UTC+2 | | Eastern European Summer Time | EEST | UTC+3 | | Moscow Standard Time | MSK | UTC+3 | | Central European Time (Croatia) | CET | UTC+1 | | Eastern European Time (Estonia) | EET | UTC+2 | | Western European Time (Portugal) | WET | UTC+0 | | Central European Time (Spain) | CET | UTC+1 | | Eastern European Time (Finland) | EET | UTC+2 | | Central European Time (Norway) | CET | UTC+1 | | Eastern European Time (Romania) | EET | UTC+2 | | Central European Time (Switzerland)| CET | UTC+1 | | Eastern European Time (Turkey) | EET | UTC+3 |

Middle Eastern Timezones

| Timezone Name | Timezone Code | Offset | |------------------------|---------------|-----------| | Arabia Standard Time | AST | UTC+3 | | Israel Standard Time | ISST | UTC+2 | | Turkey Time | TRT | UTC+3 | | Iran Standard Time | IRST | UTC+3:30 | | Iraq Standard Time | AST | UTC+3 | | United Arab Emirates Standard Time | GST | UTC+4 | | Qatar Standard Time | AST | UTC+3 | | Oman Standard Time | GST | UTC+4 | | Kuwait Standard Time | AST | UTC+3 | | Bahrain Standard Time | AST | UTC+3 | | Yemen Standard Time | AST | UTC+3 | | Jordan Standard Time | EET | UTC+2 | | Lebanon Standard Time | EET | UTC+2 | | Syria Standard Time | EET | UTC+2 | | Palestine Standard Time | EET | UTC+2 |

Asian Timezones

| Timezone Name | Timezone Code | Offset | |-------------------------------|---------------|-----------| | China Standard Time | CST | UTC+8 | | Japan Standard Time | JST | UTC+9 | | Korea Standard Time | KST | UTC+9 | | India Standard Time | IST | UTC+5:30 | | Pakistan Standard Time | PKT | UTC+5 | | Bangladesh Standard Time | BST | UTC+6 | | Southeast Asia Time | SGT | UTC+8 | | Australia Western Standard Time| AWST | UTC+8 | | Hong Kong Time | HKT | UTC+8 | | Indochina Time | ICT | UTC+7 |

Oceanian Timezones

| Timezone Name | Timezone Code | Offset | |-----------------------------------|---------------|-----------| | Australian Eastern Time | AET | UTC+11 | | Australian Central Time | ACT | UTC+10:30 | | Australian Central Standard Time | ACST | UTC+9:30 | | Australian Western Standard Time | AWST | UTC+8 | | Fiji Standard Time | FJT | UTC+12 | | New Zealand Standard Time | NZST | UTC+12 | | New Zealand Daylight Time | NZDT | UTC+13 | | Papua New Guinea Time | PGT | UTC+10 | | Solomon Islands Time | SBT | UTC+11 | | Vanuatu Standard Time | VUT | UTC+11 | | Wallis and Futuna Time | WFT | UTC+12 | | Norfolk Island Time | NFT | UTC+11:30 | | Tonga Standard Time | TOT | UTC+13 | | Samoa Standard Time | SST | UTC-11 | | Tokelau Time | TKT | UTC+13 | | Tuvalu Time | TVT | UTC+12 |

Long Date Format

Converting timestamps in long date format is just as easy:

const discstamp = require('discstamp');
const longDateTimestamp = 'August 27, 2023 19:45:00 UTC';
const discordTimestampFromLongDate = discstamp.longdate(longDateTimestamp);
console.log(discordTimestampFromLongDate);

Custom Formats

discstamp supports an array of other formats as well, including DD/MM/YYYY, MM/DD/YYYY, Human-Readable Textual Formats, Julian Date, and more. Each format has its own corresponding function that you can use similarly to the examples above.

Experiment with different formats and timestamps to see how discstamp can seamlessly integrate timestamp conversions into your projects!

For more details on supported formats and functions, refer to the Supported Formats section.

Feel free to share your usage examples and innovative timestamp conversions with the discstamp community!

Feel free to share your usage examples and innovative timestamp conversions with the discstamp community!

Contributing

We encourage contributions from the community! To get involved, please follow our contribution guidelines. Feel free to create an PR or an issue if you wish to contribute Github Repo

License

This project is licensed under the GNU License.

Note: Package is being maintained to the fullest, apologies if you need to reinstall