Skip to content

ajilraju/actions-date

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub Action for dates and timestamps

An Action to run date commands.

Usage

Exposing the date and time according the options.

- uses: ajilraju/[email protected]
  with:
    args: date +%F
    
- uses: ajilraju/[email protected]
  with:
    date --date='2 days ago'

- uses: ajilraju/[email protected]
  with:
    date -d 1may '+%B %-d'

Examples of date

Here are a few examples. Also see the documentation for the -d option in the previous section.

  • To print the date of the day before yesterday:
date --date='2 days ago'
  • To print the date of the day three months and one day hence:
date --date='3 months 1 day'
  • To print the day of year of Christmas in the current year:
date --date='25 Dec' +%j
  • To print the current full month name and the day of the month:
date '+%B %d'

But this may not be what you want because for the first nine days of the month, the ‘%d’ expands to a zero-padded two-digit field, for example ‘date -d 1may '+%B %d'’ will print ‘May 01’.

  • To print a date without the leading zero for one-digit days of the month, you can use the (GNU extension) ‘-’ flag to suppress the padding altogether:
date -d 1may '+%B %-d'
  • To print the current date and time in the format required by many non-GNU versions of date when setting the system clock:
date +%m%d%H%M%Y.%S
  • To set the system clock forward by two minutes:
date --set='+2 minutes'

Reference

Thank you

About

GitHub action to use the date command for the build process.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •