Skip to content
clock

GitHub Action

Current Time 2

v1.1.0 Latest version

Current Time 2

clock

Current Time 2

Get the current time with format

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Current Time 2

uses: srfrnk/[email protected]

Learn more about this action in srfrnk/current-time

Choose a version

Current Time Javascript Action

This action sets the current ISO8601 time to the time output. Useful for setting build times in subsequent steps, or keeping the same recorded time for the entire workflow.

Inputs

format

Time format to use - using MomentJS syntax - optional

Outputs

time

The UTC time when this step was run.

formattedTime

The UTC time when this step was run - formatted using format input.

Example usage

steps:
  - name: Get current time
    uses: srfrnk/current-time@master
    id: current-time
    with:
      format: YYYYMMDD
  - name: Use current time
    env:
      TIME: "${{ steps.current-time.outputs.time }}"
      F_TIME: "${{ steps.current-time.outputs.formattedTime }}"
    run: echo $TIME $F_TIME