Javascript to Convert Timestamp or Date to Local Relative Time

convert-timestamp-to-date

Converting timestamp or date to local relative time is a JavaScript library with relatively light time (less than 1 KB), and converts timestamps into a readable time format, such as “5 minutes ago”, “in 7 days”, etc. that.

convert timestamp to date, convert timestamp to date javascript, different timestamp formats, timestamp format, unix timestamp format, how to convert timestamp to date

How to make use of it:

1. Install and import the relative-time.js.

# NPM
$ npm i @yaireo/relative-time
import RelativeTime from ‘@yaireo/relative-Time’

2. Or load the relative-time.js JavaScript library within the doc.

<script src=”relative-time.min.js”></script>

3. Initialize the relative-time.js.

const relativeTime = new RelativeTime();

4. Custom native is supported as properly.

const relativeTimeSpanish = new RelativeTime({ 
      locale: 'fr' 
});

5. Convert timestamps to relative time as follows:

relativeTime.from(new Date('10/20/1984'))
=> 37 years ago

Convert Timestamp To User-friendly Format, Transform timestamp or date to local relative-time Github, timestamp format milliseconds, date timestamp format


See Demo And Download

Official Website(yairEO): Click Here

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

Share