Hi! I am trying to get a duration of the project by calculation the number of days between today and the project submit date. They are both in the same format (mm/dd/yy), but there are no results. What am I doing wrong?
| eval "Project Submit Date"=strftime(strptime(project_submit_date,"%Y-%m-%d %H:%M:%S"), "%m-%d-%y")
| eval today=strftime(now(), "%m-%d-%y")
| eval "Duration"=(today-'Project Submit Date')/86400
Thank you very much!
The problem is you are converting an epoch time back into text before performing your delta between the two dates when you do a strftime after the strptime. You can actually just use one eval to accomplish what you are looking for:
| eval "Duration"=round(abs((relative_time(now(), "@d")-relative_time(strptime(project_submit_date,"%Y-%m-%d %H:%M:%S"), "@d"))/86400),0)
The problem is you are converting an epoch time back into text before performing your delta between the two dates when you do a strftime after the strptime. You can actually just use one eval to accomplish what you are looking for:
| eval "Duration"=round(abs((relative_time(now(), "@d")-relative_time(strptime(project_submit_date,"%Y-%m-%d %H:%M:%S"), "@d"))/86400),0)
Thank you!