Code Monkey home page Code Monkey logo

time-zone-converter's Introduction

Timezone converter

Timezone converter is a webapplication where one can convert specfic time from one time zone to other timezone.

Screenshots

Web view

Web view

Mobile view

Mobile view

Live url

Click here

Local setup

To run this application in local execute the following commands

Clone the repo

git clone https://github.com/saketh-kowtha/time-zone-converter.git

Node modules installation

npm install

Running in local

npm run dev
# Hit http://localhost:3000 from your browser.

API Usage

If you are running in local then DOMAIN url is http://localhost:3000 otherwise https://time-zone-converter.vercel.app/

URL: <DOMAIN>/api/time-zone-converter?ts=1630760210003&from=asia%2FBangkok&to=zulu
Method: GET
Query params:
  ts: Timestramp
  *from: Timezone
  *to: Timezone
  format: Expected date format.

Sample Response:
{
  "ts": "1631440962290",
  "fromTz": "asia/kolkata",
  "toTz": "japan",
  "asia/kolkata": "12-09-2010",
  "japan": "12-09-2010",
  "ISODate": "2021-09-12T10:02:42.290Z",
  "format": "DD-MM-YYYY"
}

Query params

Param Mandatory Description Example Default value
ts NO This is optional if it didn't passed then API will consider current time as ts 1630760210003 Current timestramp
from Yes From timezone Asia%2FCalcutta -
to Yes To timezone Asia%2FCalcutta -
format No Date format (For formats you can use momentjs formats) DD-MM-YYYY ISO 8601, no fractional seconds

Refer this link for formats (format query param)

Using with cURL

curl 'https://time-zone-converter.vercel.app/api/time-zone-converter?ts=1630760210003&from=asia%2FBangkok&to=zulu'

Using with Fetch

fetch('https://time-zone-converter.vercel.app/api/time-zone-converter?ts=1630760210003&from=asia%2FBangkok&to=zulu', {
    body: null,
    method: 'GET',
})
    .then((response) => response.json())
    .then((data) => console.log(data))

Using with Axios

axios
    .get('https://time-zone-converter.vercel.app/api/time-zone-converter?ts=1630760210003&from=asia%2FBangkok&to=zulu')
    .then((response) => console.log(response.data))
    .catch(console.error)

time-zone-converter's People

Contributors

saketh-kowtha avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

time-zone-converter's Issues

1 second behind

When comparing to my macbook clock, your clock appears to be one second behind.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.