Getting the start date and time of a workflow

Is there an environment variable for the build start date and time? I need this value within my workflow config so that I can use it as part of a notification I am sending out.

You can just run date to get the current date/time. If you want it in a variable, you can do:

DATENOW=`date`

and then use $DATENOW afterwards.

Sorry I should clarify that I need the start date of when the workflow was triggered.
Basically what is shown here:

Hmm, not sure. Will they always be triggered by a code push? If so, you could parse the last Git commit for a timestamp.

However, this won’t get an accurate workflow start for (a) scheduled jobs and (b) rebuilds.

It’s obviously stored by CircleCI somewhere. I might just submit a support ticket, thanks!

Exposing that info might need to be requested at https://circleci.com/ideas.

Ah, here’s an idea!

  • In your first job, create a folder and write a timestamp to a file inside it (or if you do not have a consistent first job for all workflows, create a new job just for this purpose)
  • Declare the folder as a workspace
  • For every job that needs this data, restore the workspace
  • Read the timestamp information from the file

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.