Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
const moment = require('moment');
const dateFromElastic = 1521806390519;
let dateUTC = moment.utc(dateFromElastic).format('YYYY-MM-DD HH:mm');
// for interface display
let dateLocal = moment.utc(dateUTC).local().format('YYYY-MM-DD HH:mm');
// for timeFilter to use as query
let dateBackToUTC = moment(dateLocal).utc().format('YYYY-MM-DD HH:mm');
console.log('UTC',dateUTC, '\nlocal', dateLocal, '\nbackToUTC', dateBackToUTC);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.