easyampm

This is a simple package for converting given Seconds (second count starts from 12:00AM) into 12/24H time format.

Usage no npm install needed!

<script type="module">
  import easyampm from 'https://cdn.skypack.dev/easyampm';
</script>

README

easy-ampm

This is a simple package for converting given Seconds (second count starts from 12:00AM) into 12/24H time format.

Installation

npm i easyampm --save

Then...

import {easyampm} from 'easyampm';

let converted_time = easyAmPm({
    time: 6300,
    format: "12H",
    spaced: false
});

Options

easyAmPm() supports 3 options (1 of them is required)

  • time - seconds (Required | Must be an Integer number between 0 to 86399)
  • format - 12H | 24H (Default is 12H)
  • spaced - boolean (Default is false)

Examples

  • spaced - true => 12:10 AM false => 12:10 AM