- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
To find number of days between two dates
Please give a solution to calculate the number of days between two given dates..
Regards
Govind.
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

...| eval start = strptime(date1, "%Y-%m-%d %H:%M:%S")| eval end = strptime(date2, "%Y-%m-%d %H:%M:%S")| eval duration = round((end-start)/86400)
Converts column to timestamp(epoc): strptime(field, date_format)
This will give you the duration in days (example): 23
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
HI, Just a small question here: What if I want to remove the weekend from this calculation.
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

hi @Chandras11
have a look into this links:-
https://answers.splunk.com/answers/306182/how-to-exclude-weekends-saturday-and-sunday-from-a.html
https://answers.splunk.com/answers/426673/how-to-filter-out-weekdays-or-weekends-in-one-sear.html
Harish
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi ,
source="dmon-tail://idhouse/id_account" application=TFD [|inputlookup execSSO.csv |rename sso as owner] |eval exp_date=strftime(relative_time(strptime(lastPasswordChange,"%Y-%m-%d %H:%M:%S"),"+90d@d"), "%Y/%m/%d %H:%M")
This query is working good .
I need one more help ,
I want to count the days between exp_date and today date
any one can help me on this ...
Thank u ,
Regards,
Siraj
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
i need to generate a time based report. Below are the inputs
Start Date : string
End Date : string
I need the no of days from ( now to startDate) and (now to endDate), so that i can play around.
Thanks
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

You really need to provide more context on this, such as, where are these dates coming from?
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

... | eval (timestamp2-timestamp1)/86400
is whatI can do with the information you've given.
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Ok, so what's not working with the provided solution?
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is not working....
Here is my scenario... I have event coming in SPLUNK from database and i have 2 date columns in it. I need to get the difference between the 2 days and want to filter all records that are greater than 30 days.
