Skip to content

PPA Tools PPA Tools: Date

Summary

This module contains actions for dealing with dates & times.

Actions

ppa_tools.date.

add_delta

Create a future Date by adding days, hours, & minutes to a date & time.

If no date is supplied, the current date & time will be used.

All generated dates have a UTC timezome

Minimum Plugin Version: 7.0.0

Input

days: number of days to add (defaults to 0)

hours: number of hours to add (defaults to 0)

minutes: number of minutes to add (defaults to 0)

start_date: optional Date to use as the start point (defaults to current date & time)

Output

Date

Example
1
2
3
- ppa_tools.date.add_delta:
    days: 30
  save: date

ppa_tools.date.

from_string

Create a Date from a date & time string.

The date & time string must be in the following format:

hour:minute:second day/month/year

For example:

09:00:00 21/03/2022

All generated dates have a UTC timezome

Minimum Plugin Version: 7.0.0

Input

string: the date & time string

Output

Date

Example
1
2
3
- ppa_tools.date.from_string:
    string: 09:00:00 21/03/2022
  save: date

ppa_tools.date.

get_delta

Get the total number of seconds between two Dates.

Minimum Plugin Version: 7.0.0

Input

start: the start Date

end: the end Date

Output

A dictionary containing the following keys:

  • total_seconds

  • total_minutes

These keys should be treated independently (total_minutes = total_seconds divided by 60).

Example
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
- ppa_tools.date.now:
  save: now

- ppa_tools.date.add_delta:
    days: 30
  load:
    start_date: now
  save: future

- ppa_tools.date.get_delta:
  load:
    start: now
    end: future
  save: delta

ppa_tools.date.

now

Get the current UTC date & time.

Minimum Plugin Version: 3.0.0

Input

This action takes no inputs.

Output

A single Date dictionary.

Example
1
2
- ppa_tools.date.now:
  save: date