Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DateTime macro extension 'short_date' #5870

Closed
wols opened this issue Dec 15, 2017 · 2 comments
Closed

DateTime macro extension 'short_date' #5870

wols opened this issue Dec 15, 2017 · 2 comments
Labels
no-issue Better asked in one of our support channels

Comments

@wols
Copy link

wols commented Dec 15, 2017

The DateTime macros in https://github.com/Icinga/icinga2/blob/master/lib/icinga/icingaapplication.cpp are timet, long_date_time, short_date_time, date, time and uptime.

I must check NTP stats files with a "short date" suffix, eg. ntpstats.20171224.

I want a new option $icinga.short_date$ = FormatDateTime("%Y%m%d", now).
Is this a possible (christmas) option?

@gunnarbeutner
Copy link
Contributor

Well, looks like Christmas came early (again) 😇:

vars.short_date = {{ DateTime().format("%Y%m%d") }}

This will take the current timestamp and format it using the format string given to format(). You can format a specific timestamp by supplying an argument to the constructor for the DateTime type.

@wols
Copy link
Author

wols commented Dec 15, 2017

Thanks! This is a cool gift ;-)

@dnsmichi dnsmichi added no-issue Better asked in one of our support channels and removed no-issue Better asked in one of our support channels question labels May 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-issue Better asked in one of our support channels
Projects
None yet
Development

No branches or pull requests

3 participants