I am working on the Jenkins jobs. There is already a job created with this command. I need someone's help to guide me about the time settings in command line. There are two variables for start and end time. Kindly , can you explain that what will be the start and ending time in simple English
export start_date=$(date -d "yesterday 00:00:00 " +%s)
export end_date=$(date +%s)
From man date
:
%s is the number of seconds since 1970-01-01 00:00:00 UTC
So for the start_date
, the command is saying grab the date from yesterday, with time 00:00:00. And then once you have that date, then get the number of seconds elapsed from the Unix epoch (01/01/1970) until that date. So for example, today is 4/14/2016, so start_date
is equal to the number of seconds from 1/1/1970 00:00:00
to 4/13/2016 00:00:00
.
The end_date
is the number of seconds elapsed since the Unix epoch (01/01/1970), from right now (the current time).