Splunk Search

Time format

hxa27
Path Finder

Hi,

I am using DB connect to fetch a table from the database which the table was imported as an Excel to the database. But, the problem is the time is showing like 1396760400.000 and tried different commands like convert, replace and other ones but the date is not changing. Also, when I tried just to rename the header of the field, I could not either. So, I have no idea what the problem is.
Idea/ suggestion would be great

Thanks

0 Karma

harshavrath
Contributor

the date format that you are getting is an EPOCH time you can convert it by

to__char(date_field, 'DD-MON-YYYY HH24:MI:SS')

ex:SELECT to__char(date_filed, 'dd-mm-yyyy hh24:mi:ss AM') FROM table_name

0 Karma

linu1988
Champion

you wont be able to get in normal sql query. you need to do it splunk query. What is the database you are using?

0 Karma

hxa27
Path Finder

Non of these worked not because they are wrong but I am not able to change anything in the particular column. Idea in how to fix this issue

0 Karma

harshavrath
Contributor

try this even this works

fieldformat new_date=strftime(dat_field,"%d-%m-%Y %H: %M: %S")

0 Karma

linu1988
Champion

try of convert ctime(datetime_column) is working?

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

Splunk Lantern is Splunk’s customer success center that provides advice from Splunk experts on valuable data ...