top of page
  • Writer's pictureJatin Madaan

Unix Command to get date's value between date range given.

Updated: Feb 10, 2019


Defining dates : it can be in any format as we are converting this in seconds .


start_date=$(date -d "2019-01-01" +%s);

end_date=$(date -d "2019-01-05" +%s);


## to print date values between above dates

while [[ "$start_date" -le "$end_date" ]]; do date -d "@$start_date" +%F; let start_date+=86400; done


output :

2019-01-01

2019-01-02

2019-01-03

2019-01-04

2019-01-05




13 views0 comments

Comments


bottom of page