Skip to main content


Showing posts with the label epoch

Batch Epoch time converter in java and shell wrapper

I had to create a sample script to convert epoch time to Human readable format.  (both ways) Also from Human readable time format to Epoch.  Input is a file with "Epoch" or "Human Readable"  format and the program will convert in the other format. This could be used for embedding into your application or for batch convert, please find my program in Java .... Afterwards, you can put this java file into a shell script if you want to automate your linux scripts Usage: <scriptname> <inputfiletimeformat> <input_file_name_full_path> ....

Perl Convert Epoch to Human timestamp YYYY-MM-DD HH:MM:SS

Ready made module in Perl to convert epoch time to DB2 or Human timestamp formats  (YYYY-MM-DD HH:MM:SS) Write a function convertEpochToHumanTimestamp and call this from the required sub.     # Function    : convertEpochToHumanTimestamp # Description : Convert Epoch into a formatted time suitable for insertion into a Human database timestamp #               column. The output format is "YYYY-MM-DD HH:MM:SS" my $inputEpoch = shift; my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($inputEpoch); $mon++; $year = $year + 1900; my $humanTime = sprintf ("%04d-%02d-%02d %02d:%02d:%02d", $year, $mon, $mday, $hour, $min, $sec); return ($humanTime);