Giter Club home page Giter Club logo

actions-date's Introduction

(Forked just in case it goes away. Originally by ajilraju.)

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

actions-date's People

Contributors

ajilraju avatar mcgrue avatar paolorevillosa avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.