Splunk Search

extract only date from a date time field

surekhasplunk
Communicator

Example  i have a csv where the date is like this in the date field

Billing Start= 43774.7083333

But when i format the cell manually i see the actual date is 11/5/2019  5:00:00 PM which is correct. 

And I am using below query but not working. Can you please help to get the above correct date. 

eval date=strftime('Billing Start',"%M/%d/%Y %H:%M:%S %p")

It gives me below output

43774.708333309/01/1970 13:09:34 PM
Labels (1)
Tags (3)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

The strftime function expects it's input to be in Linux epoch time format, but the Billing Start field appears to be in Microsoft's date format, which is not the same.

Convert from Excel dates to Unix/Linux dates using this formula

Unix Timestamp = (Excel Timestamp - 25569) * 86400

See https://stackoverflow.com/questions/1703505/excel-date-to-unix-timestamp for more.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Dashboards: Hiding charts while search is being executed and other uses for tokens

There are a couple of features of SimpleXML / Classic dashboards that can be used to enhance the user ...

Splunk Observability Cloud's AI Assistant in Action Series: Explaining Metrics and ...

This is the fourth post in the Splunk Observability Cloud’s AI Assistant in Action series that digs into how ...

Brains, Bytes, and Boston: Learn from the Best at .conf25

When you think of Boston, you might picture colonial charm, world-class universities, or even the crack of a ...