Convert a future date into epoch seconds on HPUX system
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.
But we don't have -d option in HPUX.
What would be an alternate method to convert any given date to epoch seconds on HPUX systems?
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)
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)
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 :
date -d "2007-09-01 17:30:40" '+%s'
But this gives me below error
date: illegal option -- d
Usage: date
OS: AIX... (6 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 used a bash script which ultimately converts a string into date using date --date option:
DATE=$DATE" "$TIME" "`date +%Y` //concatenating 2 strings
TMRW_DATE=`date --date="$DATE" +"%s"` //applying date command on string and getting the unixtime
Please use code tags... (7 Replies)
I am not able to pass date stored in a variable as an argument to date command. I get current date value for from_date and to_date
#!/usr/bin/ksh
set -x
for s in server ; do
ssh -T $s <<-EOF
from_date="12-Jan-2015 12:02:09"
to_date="24-Jan-2015 13:02:09"
echo \$from_date
echo... (7 Replies)
Hello Team,
I am stuck in getting the required output in the following case. Please help.
My input file is
aa|08/01/2016
bb|08/15/2016
I wish to convert the file into
aa|epoch time
bb|epoch time
I am using following code: (3 Replies)
Discussion started by: angshuman
3 Replies
LEARN ABOUT OPENDARWIN
tcl_gettime
Tcl_GetTime(3) Tcl Library Procedures Tcl_GetTime(3)__________________________________________________________________________________________________________________________________________________NAME
Tcl_GetTime - get date and time
SYNOPSIS
#include <tcl.h>
Tcl_GetTime( timePtr )
ARGUMENTS
Tcl_Time * timePtr (out) Points to memory in which to store the date and time information.
_________________________________________________________________DESCRIPTION
The Tcl_GetTime function retrieves the current time as a Tcl_Time structure in memory the caller provides. This structure has the follow-
ing definition:
typedef struct Tcl_Time {
long sec;
long usec;
} Tcl_Time;
On return, the sec member of the structure is filled in with the number of seconds that have elapsed since the epoch: the epoch is the
point in time of 00:00 UTC, 1 January 1970. This number does not count leap seconds - an interval of one day advances it by 86400 seconds
regardless of whether a leap second has been inserted.
The usec member of the structure is filled in with the number of microseconds that have elapsed since the start of the second designated by
sec. The Tcl library makes every effort to keep this number as precise as possible, subject to the limitations of the computer system. On
multiprocessor variants of Windows, this number may be limited to the 10- or 20-ms granularity of the system clock. (On single-processor
Windows systems, the usec field is derived from a performance counter and is highly precise.)
SEE ALSO
clock
KEYWORDS
date, time
Tcl 8.4 Tcl_GetTime(3)