city-time

0.0.3 • Public • Published

City Time

PyPI version
City time is a package whihc will return a the current time of a givent city.This was build with the support of moment js.

Usage

$ npm i city-time

Example

Basic method as follows

const citytime= require('city-time');
console.log(citytime.getTimeForCity('Colombo'))

The following is the output for above code

Sun Sep 05 2021 22:31:22 GMT+0530

getTimeForCity() function accpets two paramters

  1. City Name (Required)
  2. option (Optional)

Usage

const citytime= require('city-time');
console.log(citytime.getTimeForCity('Colombo',options={object=true}))

Object Property is false in default.But once you set it to true it will return a mooment.js object

The following is the output for above code

Moment<2021-09-05T22:42:58+05:30>
const citytime= require('city-time');
console.log(citytime.getTimeForCity('Colombo',options={format='YYYY'}))

The following is the output for above code

2021

format Property is empty in default.You can pass mooment js options to get the relevent format dates Available format :

YYYY: 4-digit year 
YY: 2-digit year 
MMMM: Full-length month 
MMM: 3 character month 
MM: Month of the year, zero-padded 
M: Month of the year 
DD: Day of the month, zero-padded 
D: Day of the month 
Do: Day of the month with numeric ordinal contraction 

Speiccla thanks for city-timezonescity-timezones

Readme

Keywords

Package Sidebar

Install

npm i city-time

Weekly Downloads

0

Version

0.0.3

License

MIT

Unpacked Size

1.92 MB

Total Files

6

Last publish

Collaborators

  • ffalpha