How do I get the current time in my timezone?

This topic was automatically generated from Slack. You can find the original thread here.

Mandar Badve : Hi, I am new to this platform. In one of the workflow I am posting a new tweet. In tweet text I want to add current time. Is there any built in path/keyword to add time? I have used {{event.time}} but this is giving time in UTC I guess. I need time in current with specific time zone or WRT to my account time zone.

Dylan Sather (Pipedream) : welcome!

I just published an action called Get Current Time in Timezone. This lets you pass a timezone string as a param, and returns the current time in that localized timezone. Check out this workflow for an example.

Note - since you can run any Node.js code on Pipedream, I just used the moment-timezone library to build this action. You can use similar code anywhere in your workflow - just expand the code section of that action to see how it works.

Let me know if that helps.

Dylan Sather (Pipedream) : I also published a similar action - Get Time in Timezone - which accepts both a timezone and an ISO 8601 timestamp, so this lets you convert any timestamp (for example, event.time) to the target timezone. See example here.

Hi @dylburger
I need to get the current time for a specific timezone in a workflow, where I add a single line to a google sheet. One column must be the timestamp with current time for timezone.
Your workflow “Get current time in timezone” as posted above does return the data, but I fail to use it in my workflow. Could you help me?
I copied your workflow and it runs fine. But how do I add it to my own workflow?
Do I need to call the “get current time” workflow from within my own workflow? If yes, how do I get the returned value to be used in downstream steps?
Or do I need to create an “action” from it? I haven’t done this before.
Or can I just add your coding to a code-step in my workflow? I failed when trying this.
If you could briefly explain what would be the way to do it, you would greatly help me.
Thank you,

Hi @johannes1

That workflow above is a v1 workflow, and we no longer support that format.

But you can follow this guide to format a date with a library like date-fns:

Here’s the code you can copy and paste into a Node.js code step in your workflow:

// Adding properties to a regular Node.js code step make it publishable
import { parseISO, format } from 'date-fns';

// Returns a formatted datetime string
export default defineComponent({
  name: 'Format Date',
  version: '0.0.1',
  key: 'format-date',
  type: 'action',
  props: {
    date: {
      type: "string",
      label: "Date",
      description: "Date to be formatted",
    format: {
      type: 'string',
      label: "Format",
      description: "Format to apply to the date. [See date-fns format]( as a reference."

   timezone: {
     type: 'string', 
     label: 'format',
     description: "Timezone to format the date to. [See date-fns timezones]( for examples. [Uses IANA timezone format]("
  async run({ $ }) {
    const formatted = format(parseISO(, this.format, { timeZone: this.timezone });
    return formatted;

To wire steps together, you can use step exports. Here’s a short tutorial on how to do that:

Hi @pierce thank you so much for this code snippet with date-fns.
It solved my problem and was very easy to use and very versatile in output date formatting!
Kind regards,