Get time in timezone
@dylburger
code:
data:privatelast updated:3 years ago
today
Build integrations remarkably fast!
You're viewing a public workflow template.
Sign up to customize, add steps, modify code and more.
Join 800,000+ developers using the Pipedream platform
steps.
trigger
HTTP API
Deploy to generate unique URL
This workflow runs on Pipedream's servers and is triggered by HTTP / Webhook requests.
steps.
current_time
auth
to use OAuth tokens and API keys in code via theauths object
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.
async (event, steps) => {
1
2
}
3
return new Date()
steps.
get_time_in_specific_timezone
Given an ISO 8601 timestamp, and a timezone, convert the time to the target timezone.
params
ISO 8601 Time

An ISO 8601 string representing the time you'd like to convert to your target timezone. If this timestamp doesn't have a timezone component, it's assumed to be in UTC.

{{steps.current_time.$return_value}}
string ·params.time
Timezone

The IANA timezone name, e.g. America/Los_Angeles. See the full list here.

America/Los_Angeles
string ·params.timezone
code
async params => {
1
2
3
}
4
const moment = require("moment-timezone")
return moment.tz(params.time, params.timezone).format();
steps.
nodejs
auth
to use OAuth tokens and API keys in code via theauths object
code
Write any Node.jscodeand use anynpm package. You can alsoexport datafor use in later steps via return or this.key = 'value', pass input data to your code viaparams, and maintain state across executions with$checkpoint.
async (event, steps) => {
1
2
3
4
}
5
const dateFormat = require("dateformat");
const meeting_date = steps.get_time_in_specific_timezone.$return_value;
this.date = dateFormat(meeting_date, "dddd, mmmm dS, yyyy, HH:MM:ss p");