A Fast, Lightweight Library to Translate Between Time Zones and UTC | xtz.js

xtz.js is a fast, lightweight, dependency-free library for translation between timezones and UTC with the native Intl.DateTimeFormat format at ~100 LoC. For Node.js and browsers.

time converter calculator, utc to local time converter, time conversion chart, world time converter, time zone converter classic, time difference calculator

How to make use of it:

1. Insert the JavaScript xtz.js into the HTML doc.

<script src="./xtz.js"></script>

2. Initialize.

var XTZ = window.XTZ;

3. Convert Relative TimeZone to Absolute UTC.

// toUTC(dtString, timeZone)
XTZ.toUTC("2021-06-03 12:52:46.007", "Asia/Shanghai")
   .toISOString()
// => 2021-06-03T12:52:46.007+0800

// OR 
// toUTCISOString(dtString, timeZone)
XTZ.toUTCISOString("2021-06-03 12:52:46.007", "Asia/Shanghai")
// => 2021-06-03T12:52:46.007+0800

4. Convert Absolute UTC to Relative TimeZone.

// toTimeZone(utcDate, timeZone)
XTZ.toTimeZone("2021-06-03T04:50:36.715Z", "Asia/Shanghai")
  .toISOString()
// => 2021-06-03T12:50:36.715+0800

// OR 
// toTimeZoneISOString(isoString, timeZone)
XTZ.toTimeZoneISOString("2021-06-03T04:50:36.715Z", "Asia/Shanghai")
// => 2021-06-03T12:50:36.715+0800

Time Zones And UTC Converter, xtz.js Plugin/Github


See Demo And Download

Official Website(therootcompany): Click Here

This superior jQuery/javascript plugin is developed by therootcompany. For extra Advanced Usages, please go to the official website.

Related Posts

Iconpicker-Bootstrap-5

[Icon Picker] Iconpicker for Bootstrap 5 Icons Library

Bootstrap 5-based icon picker which supports any icon libraries like Bootstrap Icons, Font Awesome[fontawesome.com], etc. Must Read: 1000+ Pixel Perfect SVG Icons For Vue Components | Unicons How…

bootstrap-multiple-image-upload-with-preview

Bootstrap Multiple Image Upload with Preview and Delete | ImagesLoader

ImagesLoader is a standard bootstrap image upload plugin that provides an easy-to-use and nice-looking interface for uploading multiple images to a web server. Must Read: HTML 5…

Animating-Split-Flap-Displays-fallblatt

A Lightweight jQuery Plugin for Animating Split-Flap Displays | fallblatt

fallblatt is a lightweight jQuery plugin for animating split screens. This jQuery plugin allows you to include such offers in your web application. Everything from virtual departure…

bootstrap-5-dark-theme

Dark & Light Switch Mode Toggle for Bootstrap 5

Switching to dark mode is done by toggling HTML tags that include -dark or -light as a category. It is made by manipulating the DOM with JavaScript. The text color also changes depending…

jQuery-SyoTimer-Plugin

jQuery Plugin for Countdown Timer on HTML Page | SyoTimer

yoTimer jQuery plugin allows you to create digital style countdowns/periodic timers on the webpage, with callbacks support and timezone/translation customization. Features Periodic count with the specified period…

vue-js-periodic-table

Dynamic, Data-driven Periodic Table built with Vue.js

Periodicity is a dynamic, data-driven periodic table created with Vue.js that uses D3 animations and graphs to show the beauty of periodic trends. Built With vue.js (component…