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

Job option automatic datestamp ${DATE:..} is not documented #309

Closed
gschueler opened this issue May 23, 2017 · 15 comments · Fixed by #330
Closed

Job option automatic datestamp ${DATE:..} is not documented #309

gschueler opened this issue May 23, 2017 · 15 comments · Fixed by #330
Assignees

Comments

@gschueler
Copy link
Member

Issue type: Documentation

You can use the string ${DATE:format} as a job option vlaue, which will be converted when the job/command is executed.

${DATE:format} current date in format used by the Java SimpleDateFormatter

${DATE+2:format} two days from now

${DATE-2:format} two days ago

@ahonor
Copy link

ahonor commented May 23, 2017

Could add this info to the Option edit page too

@cafemike
Copy link

cafemike commented Nov 2, 2017

${DATE:format} is working, but ${DATE+1:format} is not working for 2.9.4-1.

Also, if two arguments are using ${DATE:format} at the same time, neither of the arguments will be resolved.

@gschueler
Copy link
Member Author

@cafemike what rundeck version are you using?

@cafemike
Copy link

@gschueler This was found in version 2.9.4-1.

@gschueler
Copy link
Member Author

i could not reproduce in 2.10.

what is your job definition, and how are you entering the date string for the options? (i.e. what format are you using.

example:

${DATE:yyyyMMdd} and ${DATE+1:yyyyMMdd} both worked for me

@thiagobucca
Copy link

how can i add seconds and minutes to DATE using this option?

@gschueler
Copy link
Member Author

use ss for seconds, mm for minutes: https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html

@thiagobucca
Copy link

thiagobucca commented Jan 8, 2018

like this ${DATE:yyyyMMddmmss} ?

@gschueler
Copy link
Member Author

yes

@thiagobucca
Copy link

thanks, it worked.

@thiagobucca
Copy link

why this parameter: ${DATE-11:yyyyMMdd} 2018-01-11 evaluates to 2018-12-31, shouldn't be 2017-12-31?

@gschueler
Copy link
Member Author

@thiagobucca sounds like a bug

@RAJMODI038
Copy link

RAJMODI038 commented Feb 19, 2020

Can I add or minus "minutes, seconds" using this? It's like, supports days only.

@fablemarchand
Copy link

Can I add or minus "minutes, seconds" using this? It's like, supports days only.

have you find a solution to play on minutes or second ?

@gaddman
Copy link
Contributor

gaddman commented Oct 11, 2021

It only supports days - see the code for expandDateStrings in ExecutionService.groovy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants