https://github.com/ajilraju/actions-date
GitHub action to use the date command for the build process.
https://github.com/ajilraju/actions-date
actions clock date dates github unix
Last synced: 4 days ago
JSON representation
GitHub action to use the date command for the build process.
- Host: GitHub
- URL: https://github.com/ajilraju/actions-date
- Owner: ajilraju
- License: mit
- Created: 2019-11-27T10:33:05.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2022-03-10T05:55:57.000Z (about 4 years ago)
- Last Synced: 2026-02-20T12:24:44.151Z (about 2 months ago)
- Topics: actions, clock, date, dates, github, unix
- Language: Dockerfile
- Homepage:
- Size: 27.3 KB
- Stars: 15
- Watchers: 1
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README

# GitHub Action for dates and timestamps
An Action to run [date](https://www.gnu.org/software/coreutils/manual/html_node/Examples-of-date.html) commands.
## Usage
Exposing the date and time according the options.
```yaml
- uses: ajilraju/actions-date@v0.1
with:
args: date +%F
- uses: ajilraju/actions-date@v0.1
with:
date --date='2 days ago'
- uses: ajilraju/actions-date@v0.1
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:
```bash
date --date='2 days ago'
```
- To print the date of the day three months and one day hence:
```bash
date --date='3 months 1 day'
```
- To print the day of year of Christmas in the current year:
```bash
date --date='25 Dec' +%j
```
- To print the current full month name and the day of the month:
```bash
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:
```bash
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:
```bash
date +%m%d%H%M%Y.%S
```
- To set the system clock forward by two minutes:
```bash
date --set='+2 minutes'
```
### Reference
- [date command](https://www.gnu.org/software/coreutils/manual/html_node/Examples-of-date.html)
### Thank you