Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Convert Epoch to timestamp in a file Post 302969388 by RudiC on Tuesday 22nd of March 2016 08:03:25 AM
Old 03-22-2016
Are you sure 1969-12-31 is a correct conversion of an epoch time like 1458628242? The former is one day before the epoch:
Code:
date -d@-86400
Mi 31. Dez 01:00:00 CET 1969

---------- Post updated at 13:03 ---------- Previous update was at 13:00 ----------

And, BTW, the "epoch times" in post#1 are ambitious as well:
Code:
date -d@1454247163111
Fr 4. Apr 11:18:31 CEST 48053

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to convert epoch time to readible format?

Hi, I would like to convert epoch time from the logs to readible fromat. How do I do it within shell? Thanks! (11 Replies)
Discussion started by: cin2000
11 Replies

2. Shell Programming and Scripting

conversion from EPOCH timestamp to local time zone

hello gurus, i want a perl/shell script which once invoked should convert a set of EPOCH timestamps to local time ( IST..i want) . how does it work ,i have an idea on that..but writing a perl/shell script for it is not possible for me...so i need help for the same. my exact requirement is... (2 Replies)
Discussion started by: abhijeetkul
2 Replies

3. Shell Programming and Scripting

Convert date into epoch in Perl on Solaris

Solaris 10 doesn't seem to like me a lot. I am trying to run a simple script to accept date and return epoch of that date: #!/usr/bin/perl -w use strict; use Time::ParseDate; my($date1)="Mon Mar 27 05:54:08 CDT 2009"; chomp $date1; #Convert to seconds since start of epoch my $time1 =... (3 Replies)
Discussion started by: pavanlimo
3 Replies

4. Shell Programming and Scripting

Convert value stored in a variable to epoch time?

Hello I have a the creation date of a file stored in a variable in the following format: Wed May 06 10:14:58 2009Is there a way I can echo the variable and display it in epoch time? I've done a lot of searching on this topic, but haven't managed to get a solution. I'm on Solaris 10. ... (2 Replies)
Discussion started by: Glyn_Mo
2 Replies

5. Shell Programming and Scripting

Need to convert an epoch date to MMDDYYHHmm format

System: HP-UX Kornshell Perl is installed, but not POSIX Hello, I am calculating a future date/time. To do this I take the system date in epoch format and add to it. I now need to take the new epoch date and convert it to MMDDYYHHmm format. Any help with this is greatly appreciated. (4 Replies)
Discussion started by: LetsGoPens
4 Replies

6. Shell Programming and Scripting

Epoch & Unix Timestamp Conversion Tools

Hi All, Please read the below data carefully. I need an unix command for converting unix timestamp to Epoch timestamp. I need to daily convert this today's unix(UTC) time to epoch time, so i am thinking to make a shellscript for this. Please help me for this by providing... (3 Replies)
Discussion started by: aish11
3 Replies

7. Shell Programming and Scripting

Convert to epoch time

how can i modify the following command to instead provide the epoch time of the interfaces file? perl -le 'print scalar localtime ((stat "/home/skysmart/interfaces"))' Tue Feb 19 03:44:52 2013 i'm hoping to get the equivalent of this command: stat --format=%Y /home/skysmart/interfaces ... (2 Replies)
Discussion started by: SkySmart
2 Replies

8. Shell Programming and Scripting

Convert UNIX timestamp to readable format in the file

Hello I have a file : file1.txt with the below contents : 237176 test1 test2 1442149024 237138 test3 test4 1442121300 237171 test5 test7 1442112823 237145 test9 test10 1442109600 In the above file fourth field represents the timestamp in Unix format. I found a command which converts... (6 Replies)
Discussion started by: rahul2662
6 Replies

9. Shell Programming and Scripting

AIX : Need to convert UNIX Timestamp to normal timestamp

Hello , I am working on AIX. I have to convert Unix timestamp to normal timestamp. Below is the file. The Unix timestamp will always be preceded by EFFECTIVE_TIME as first field as shown and there could be multiple EFFECTIVE_TIME in the file : 3.txt Contents of... (6 Replies)
Discussion started by: rahul2662
6 Replies

10. Shell Programming and Scripting

Convert a string to epoch time

Team, I am working on a shell script and i am extracting a date string in "SunOS server" with below format. Mon Jan 21 04:13:48 EST 2021 Can you please assist me the best way to convert the extracted string to epoch time like "date +%s" in Linux. Thanks in advance (1 Reply)
Discussion started by: Girish19
1 Replies
DateTime::Format::Epoch::JD(3pm)			User Contributed Perl Documentation			  DateTime::Format::Epoch::JD(3pm)

NAME
DateTime::Format::Epoch::JD - Convert DateTimes to/from Julian Days SYNOPSIS
use DateTime::Format::Epoch::JD; my $dt = DateTime::Format::Epoch::JD->parse_datetime( 2453244.5 ); # 2004-08-27T00:00:00 DateTime::Format::Epoch::JD->format_datetime($dt); # 2453244.5 my $formatter = DateTime::Format::Epoch::JD->new(); my $dt2 = $formatter->parse_datetime( 2453244.5 ); # 2004-08-27T00:00:00 $formatter->format_datetime($dt2); # 2453244.5 DESCRIPTION
This module can convert a DateTime object (or any object that can be converted to a DateTime object) to the Julian Day number. This is the number of days since noon U.T.C. on January 1, 4713 B.C. (Julian calendar). This time scale was originally proposed by John Herschel, and is often used in astronomical calculations. Similar modules are: o DateTime::Format::Epoch::MJD Implements the "modified Julian Day", starting at midnight U.T.C., November 17, 1858. This number is always 2,400,000.5 lower than the JD, and this count only uses five digits to specify a date between 1859 and about 2130. o DateTime::Format::Epoch::RJD Implements the "reduced Julian Day", starting at noon U.T.C., November 16, 1858. This number is always 2,400,000 lower than the JD. o DateTime::Format::Epoch::TJD Implements the "truncated Julian Day", starting at midnight U.T.C., May 24, 1968. This number is always 2,440,000,5 lower than the JD. Actually, there is another version of the TJD, defined as JD modulo 10,000. But that one is a bit harder to implement, so you'll have to do with this version of TJD. Or don't use TJD's at all. o DateTime::Format::Epoch::RataDie Implements the Rata Die count, starting at January 1, 1 (Gregorian). This count is used by DateTime::Calendar programmers. o DateTime::Format::Epoch::Lilian Implements the Lilian count, named after Aloysius Lilian (a 16th century physician) and first used by IBM (a 19th century punched card machine manufacturer). This counts the number of days since the adoption of the Gregorian calendar. Only days are counted, and October 15, 1584 is day 1. METHODS
Most of the methods are the same as those in DateTime::Format::Epoch. The only difference is the constructor. o new() Constructor of the formatter/parser object. It has no parameters. SUPPORT
Support for this module is provided via the datetime@perl.org email list. See http://lists.perl.org/ for more details. AUTHOR
Eugene van der Pijll <pijll@gmx.net> COPYRIGHT
Copyright (c) 2004 Eugene van der Pijll. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
DateTime datetime@perl.org mailing list perl v5.10.1 2007-12-03 DateTime::Format::Epoch::JD(3pm)
All times are GMT -4. The time now is 05:39 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy