Posts: 4
Threads: 1
Joined: Feb 2018
Feb-07-2018, 09:36 PM
(This post was last modified: Feb-08-2018, 08:54 AM by buran.)
Hi everyone, pretty new to python. I am a voice engineer by trade, but am trying to learn, as automation is huge in my field. That being said here is my question. I have a report that dumps out data in epoch time. I have utilized this code to get it translated properly to CST. Although, with a report that has 5200 of these, wondering if there is a batch way to run this for all?
>>> import time
>>> epoch = 1515998448
>>> time.strftime("%a, %d %b %Y %H:%M:%S %Z", time.localtime(epoch))
'Mon, 15 Jan 2018 00:40:48 Central Standard Time' Any help is greatly appreciated!
thanks,
Jeff
Posts: 12,025
Threads: 484
Joined: Sep 2016
what format is the report source data in? looking for .csv, .json, .txt PostgreSQL, MySQL, etc.
what software produces the report.
It's possible that the reporting software can convert the time.
Or, the data can be loaded and modified.
It all depends on source format and reporting package,
Posts: 4
Threads: 1
Joined: Feb 2018
.txt primarily, i converted it over to .csv. Easier to read for customers of course.
Call manager is usually linux based on the backend, but Cisco locks it down so you cannot do anything. Even their own staff have to put in requests to get root access. Pretty crazy. So not sure if there is an easy way?
The CDR (call detail record) that it pulls from is so simplistic also, doesn't allow me to manipulate the time at all. Just gives you a date range, then exports out in only epoch. Let me know if i'm missing any information you are looking for.
Posts: 12,025
Threads: 484
Joined: Sep 2016
I know exactly what you are talking about (CDR) as my background is telecommunications.
At some point, there needs to be translation.
Is the conversion to .csv just an export, or do you manipulate the data to get there?
Posts: 4
Threads: 1
Joined: Feb 2018
(Feb-08-2018, 07:20 PM)Larz60+ Wrote: I know exactly what you are talking about (CDR) as my background is telecommunications.
At some point, there needs to be translation.
Is the conversion to .csv just an export, or do you manipulate the data to get there?
Yeah i'm sorry this got put on the backburner. I did utilize an epoch to human time converter and it went to GMT, although the client was too lazy to do the math  to central time. So yes i export it, open it up in .CSV and from there would love to see if there is a batch way to change over 5k fields from GMT to CST or just in general to CST from what CDR dumps out.
I was told by another friend general expressions might do that? Not sure, but appreciate any help!
thanks,
Jeff
Posts: 12,025
Threads: 484
Joined: Sep 2016
Feb-20-2018, 10:59 PM
(This post was last modified: Feb-20-2018, 11:00 PM by Larz60+.)
One more time, what is the format of the .csv file.
if on Linux, type:
head -10 filename.csv on windows, type:
type filename.csv | more ctrl-c after first page.
in either case, show the 10 lines.
Posts: 4
Threads: 1
Joined: Feb 2018
Feb-27-2018, 10:53 PM
(This post was last modified: Feb-27-2018, 10:55 PM by jheeman.)
Sorry, it would be done on a windows pc, utilizing a .csv file. I will try that out though myself and see if i can get it going. I truly appreciate the help!
thanks,
Jeff
Initially a text file, i just rename the extension to .csv so it will open in excel. Forgot that portion.
|