Skip to content

Instantly share code, notes, and snippets.

View GuppuBoss's full-sized avatar
:octocat:
Available for Freelance work

GuppuBoss GuppuBoss

:octocat:
Available for Freelance work
View GitHub Profile
@GuppuBoss
GuppuBoss / est_timezone_conversion.js
Created August 18, 2022 07:55
Convert Date to EST Timezone
const getESTTime = () => {
const strArray=['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
const options = { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric', timeZone: 'America/Toronto' };
const date = new Date();
date.setDate(date.getDate() + 7);
const estDate = new Date(date.toLocaleString('en-US', options));
const d = estDate.getDate();
const m = strArray[estDate.getMonth()];