🚀 Socket Launch Week 🚀 Day 5: Introducing Socket Fix.Learn More
Socket
Sign inDemoInstall
Socket

discstamp

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

discstamp

Timestamp to discord timestamp converter

1.1.21
latest
npm
Version published
Weekly downloads
8
-38.46%
Maintainers
1
Weekly downloads
 
Created
Source

discstamp Logo

discstamp

A Versatile Timestamp Converter for Discord

A powerful npm package to effortlessly convert various timestamp formats into Discord UNIX timestamps.

npm version license


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 NameTimezone CodeOffset
Eastern Standard TimeESTUTC-5
Central Standard TimeCSTUTC-6
Mountain Standard TimeMSTUTC-7
Pacific Standard TimePSTUTC-8
Alaska Standard TimeAKSTUTC-9
Hawaii-Aleutian Standard TimeHSTUTC-10
Brasília TimeBRTUTC-3
Argentina TimeARTUTC-3

European Timezones

Timezone NameTimezone CodeOffset
Central European TimeCETUTC+1
Eastern European TimeEETUTC+2
Western European TimeWETUTC+0
Irish Standard TimeISTUTC+0
Greenwich Mean TimeGMTUTC+0
Coordinated Universal TimeUTCUTC+0
British Summer TimeBSTUTC+1
Central European Summer TimeCESTUTC+2
Eastern European Summer TimeEESTUTC+3
Moscow Standard TimeMSKUTC+3
Central European Time (Croatia)CETUTC+1
Eastern European Time (Estonia)EETUTC+2
Western European Time (Portugal)WETUTC+0
Central European Time (Spain)CETUTC+1
Eastern European Time (Finland)EETUTC+2
Central European Time (Norway)CETUTC+1
Eastern European Time (Romania)EETUTC+2
Central European Time (Switzerland)CETUTC+1
Eastern European Time (Turkey)EETUTC+3

Middle Eastern Timezones

Timezone NameTimezone CodeOffset
Arabia Standard TimeASTUTC+3
Israel Standard TimeISSTUTC+2
Turkey TimeTRTUTC+3
Iran Standard TimeIRSTUTC+3:30
Iraq Standard TimeASTUTC+3
United Arab Emirates Standard TimeGSTUTC+4
Qatar Standard TimeASTUTC+3
Oman Standard TimeGSTUTC+4
Kuwait Standard TimeASTUTC+3
Bahrain Standard TimeASTUTC+3
Yemen Standard TimeASTUTC+3
Jordan Standard TimeEETUTC+2
Lebanon Standard TimeEETUTC+2
Syria Standard TimeEETUTC+2
Palestine Standard TimeEETUTC+2

Asian Timezones

Timezone NameTimezone CodeOffset
China Standard TimeCSTUTC+8
Japan Standard TimeJSTUTC+9
Korea Standard TimeKSTUTC+9
India Standard TimeISTUTC+5:30
Pakistan Standard TimePKTUTC+5
Bangladesh Standard TimeBSTUTC+6
Southeast Asia TimeSGTUTC+8
Australia Western Standard TimeAWSTUTC+8
Hong Kong TimeHKTUTC+8
Indochina TimeICTUTC+7

Oceanian Timezones

Timezone NameTimezone CodeOffset
Australian Eastern TimeAETUTC+11
Australian Central TimeACTUTC+10:30
Australian Central Standard TimeACSTUTC+9:30
Australian Western Standard TimeAWSTUTC+8
Fiji Standard TimeFJTUTC+12
New Zealand Standard TimeNZSTUTC+12
New Zealand Daylight TimeNZDTUTC+13
Papua New Guinea TimePGTUTC+10
Solomon Islands TimeSBTUTC+11
Vanuatu Standard TimeVUTUTC+11
Wallis and Futuna TimeWFTUTC+12
Norfolk Island TimeNFTUTC+11:30
Tonga Standard TimeTOTUTC+13
Samoa Standard TimeSSTUTC-11
Tokelau TimeTKTUTC+13
Tuvalu TimeTVTUTC+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.

Made with ❤️ by Matt & Caleb

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

Keywords

discord

FAQs

Package last updated on 26 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts