Date conversion from Standard/given format to seconds/epoch
I am trying get time difference of two dates in secs. Initially I want to convert a standard date format to epoch for two dates and then subtract the two epoch dates.
Example :
But this gives me below error
OS: AIX 5.3.0.0
Thanks in advance
Last edited by Franklin52; 07-15-2011 at 04:12 PM..
Reason: Please use code tags for data and code samples, thank you
I have a file named "suspected" with series of line like these :
{'protocol': 17, 'service': 'BitTorrent KRPC', 'server': '219.78.120.166', 'client_port': 52044, 'client': '10.64.68.44', 'server_port': 8291, 'time': 1226506312L, 'serverhostname': ''}
{'protocol': 17, 'service': 'BitTorrent... (3 Replies)
Hi guys,
I know that this topic has been discuss numerous times, and I have search the net and this forum for it.
However, non able to address the problem I faced so far.
I am on Solaris Platform and unable to install additional packages like the GNU date and gawk to make use of their... (5 Replies)
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)
Hello
I have log file from solaris system which has date field converted by Java application using System.currentTimeMillis() function, example is 1280943608380 which equivalent to GMT: Wed, 04 Aug 2010 17:40:08 GMT.
Now I need a function in shell script which will convert 1280943608380... (3 Replies)
Hi All,
Can someone please let me know how can i convert the date format in unix as follow:
From: 24 Oct 2011
i.e $(date +'%d %b %Y')
To: 111024
i.e $(date +%y%m%d)
Thanks in advance (3 Replies)
Looking for some help and usually when I do a search this site comes up. Hopefully someone can give me a little direction as to how to use one of these two commands to achieve what I'm trying to do.
What am I trying to do?
I need to take the time value in epoch format returned from the... (5 Replies)
Hi All,
I have scenario where i have to compare two dates.
I thought of converting them to epoch seconds and do a numeric comparison.
This works fine on Linux systems.
$ date -d '2015/12/31' +%s
1451538000
$ date +%s
1449159121
But we don't have -d option in HPUX.
What would be... (5 Replies)
Discussion started by: veeresh_15
5 Replies
LEARN ABOUT DEBIAN
time::piece::mysql
Time::Piece::MySQL(3pm) User Contributed Perl Documentation Time::Piece::MySQL(3pm)NAME
Time::Piece::MySQL - Adds MySQL-specific methods to Time::Piece
SYNOPSIS
use Time::Piece::MySQL;
my $time = localtime;
print $time->mysql_datetime;
print $time->mysql_date;
print $time->mysql_time;
my $time = Time::Piece->from_mysql_datetime( $mysql_datetime );
my $time = Time::Piece->from_mysql_date( $mysql_date );
my $time = Time::Piece->from_mysql_timestamp( $mysql_timestamp );
DESCRIPTION
Using this module instead of, or in addition to, "Time::Piece" adds a few MySQL-specific date-time methods to "Time::Piece" objects.
OBJECT METHODS
mysql_date / mysql_time / mysql_datetime / mysql_timestamp
Returns the date and/or time in a format suitable for use by MySQL.
CONSTRUCTORS
from_mysql_date / from_mysql_datetime / from_mysql_timestamp
Given a date, datetime, or timestamp value as returned from MySQL, these constructors return a new Time::Piece object. If the value is
NULL, they will retrun undef.
CAVEAT
"Time::Piece" itself only works with times in the Unix epoch, this module has the same limitation. However, MySQL itself handles date and
datetime columns from '1000-01-01' to '9999-12-31'. Feeding in times outside of the Unix epoch to any of the constructors has
unpredictable results.
Also, MySQL doesn't validate dates (because your application should); it only checks that dates are in the right format. So, your database
might include dates like 2004-00-00 or 2001-02-31. Passing invalid dates to any of the constructors is a bad idea: on my system the former
type (with zeros) returns undef (previous version used to die) while the latter returns a date in the following month.
AUTHOR
Original author: Dave Rolsky <autarch@urth.org>
Current maintainer: Marty Pauley <marty+perl@kasei.com>
COPYRIGHT
(c) 2002 Dave Rolsky
(c) 2004 Marty Pauley
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
Time::Piece
perl v5.12.4 2008-06-07 Time::Piece::MySQL(3pm)