You can always use the POSIX definition of Seconds Since the Epoch:
Quote:
If the year is <1970 or the value is negative, the relationship is undefined. If the year is ≥1970 and
the value is non-negative, the value is related to a Coordinated Universal Time name according
to the C-language expression, where tm_sec, tm_min, tm_hour, tm_yday, and tm_year are all
integer types:
The relationship between the actual time of day and the current value for seconds since the
Epoch is unspecified.
to calculate the number of seconds since the Epoch for both of your dates, subtract the start time from the end time and convert the resulting seconds into a number of days, hours, and minutes.
If you search these forums, you can also find methods of doing this using perl.
Hi Everyone,
I was very sad after a long way but still cannot figure out the duration between two date.
$date1="20090812 23:48:56";
$date2="20090813 00:01:37";
The output will be "001241".
I did the following tries, like print localtime(UnixDate(ParseDate("20090812 23:48:56"),"%s"));... (2 Replies)
I have a file which has 3 coloumns emp_name, Joining_date, Designation.
abc 12/1/2001 SSE
def 2/25/2007 SE
ghi 3/18/2009 SA
abc 8/1/2008 SSE
def 2/13/2007 SE
ghi 3/24/2005 SA
I need to find out the emp who has been in the company for longest period(Till date).
Can I have any... (3 Replies)
hi, i'm trying to figure out how to tell the amount of time a ufsdump of a directory takes. i use the below command:
echo "Starting Backup of u4" >> /backup/backup.log 2>&1
/usr/sbin/ufsdump 0uf /dev/rmt/0n /u4 >> /backup/backup.log 2>&1
echo "Finished Backup of u4" >> /backup/backup.log... (0 Replies)
Hello forum, i would like to ask if there's a way to view the remaining time of copying files (talking about copying gigabytes) while the cp commnad is running.
I'm using OpenBSD 4.9 -stable.
Thanx in advance. :) (2 Replies)
Hi,
I am looking to write a script to kill the process which are running for more than 7 days.
So i have a command like
"ps -eo pid,etime,args | grep -i xxxx" ( process which has xxx in it and running for more than 7 days needs to be killed ).
When i exeucte the above command , i am... (2 Replies)
I have used the arecord command like this
arecord -d 1 test.wav
It is keep on waiting. I need to manually interrupt it by ctrl-c. Why it is not interrupting after one second?
The arecord version which I am using is :
arecord: version 1.0.23 by Jaroslav Kysela (3 Replies)
Hi
there is a lot of file dated from last week till ofpresent date.
if i want to list only last 3 days files using ls command how can i do it
please suggest. below is the list of the file.
and i want to list files from MAy 12 to May 16.
Nov 22 2011 NSSM.UPPLSCPLB81
Jan 12... (2 Replies)
Hi , How can I check that for a single process, for example pagent for how much duration this process was up or down and also I need multiple entries if this process was down or up multiple times. Please help. (3 Replies)
I have a file with time in it. I need to find the duration between the timestamp by subtracting second row from third row and so on. and wherever it is more than 30 minutes it should display start and end time which have been subtracted
file :
00:44:11
00:44:11
00:44:13
00:44:13
00:46:51... (2 Replies)
Discussion started by: Muskaan
2 Replies
LEARN ABOUT PHP
idate
IDATE(3) 1 IDATE(3)idate - Format a local time/date as integer
SYNOPSIS
int idate (string $format, [int $timestamp = time()])
DESCRIPTION
Returns a number formatted according to the given format string using the given integer $timestamp or the current local time if no time-
stamp is given. In other words, $timestamp is optional and defaults to the value of time(3).
Unlike the function date(3), idate(3) accepts just one char in the $format parameter.
PARAMETERS
o $format
-
The following characters are recognized in the $format parameter string
+------------------+---------------------------------------------------+
|$format character | |
| | |
| | Description |
| | |
+------------------+---------------------------------------------------+
| | |
| B | |
| | |
| | Swatch Beat/Internet Time |
| | |
| | |
| d | |
| | |
| | Day of the month |
| | |
| | |
| h | |
| | |
| | Hour (12 hour format) |
| | |
| | |
| H | |
| | |
| | Hour (24 hour format) |
| | |
| | |
| i | |
| | |
| | Minutes |
| | |
| | |
| I (uppercase i) | |
| | |
| | returns 1 if DST is activated, 0 otherwise |
| | |
| | |
| L (uppercase l) | |
| | |
| | returns 1 for leap year, 0 otherwise |
| | |
| | |
| m | |
| | |
| | Month number |
| | |
| | |
| s | |
| | |
| | Seconds |
| | |
| | |
| t | |
| | |
| | Days in current month |
| | |
| | |
| U | |
| | |
| | Seconds since the Unix Epoch - January 1 1970 |
| | 00:00:00 UTC - this is the same as time(3) |
| | |
| | |
| w | |
| | |
| | Day of the week ( 0 on Sunday) |
| | |
| | |
| W | |
| | |
| | ISO-8601 week number of year, weeks starting on |
| | Monday |
| | |
| | |
| y | |
| | |
| | Year (1 or 2 digits - check note below) |
| | |
| | |
| Y | |
| | |
| | Year (4 digits) |
| | |
| | |
| z | |
| | |
| | Day of the year |
| | |
| | |
| Z | |
| | |
| | Timezone offset in seconds |
| | |
+------------------+---------------------------------------------------+
o $timestamp
- The optional $timestamp parameter is an integer Unix timestamp that defaults to the current local time if a $timestamp is not
given. In other words, it defaults to the value of time(3).
RETURN VALUES
Returns an integer.
As idate(3) always returns an integer and as they can't start with a "0", idate(3) may return fewer digits than you would expect. See the
example below.
ERRORS /EXCEPTIONS
Every call to a date/time function will generate a E_NOTICE if the time zone is not valid, and/or a E_STRICT or E_WARNING message if using
the system settings or the $TZ environment variable. See also date_default_timezone_set(3)CHANGELOG
+--------+---------------------------------------------------+
|Version | |
| | |
| | Description |
| | |
+--------+---------------------------------------------------+
| 5.1.0 | |
| | |
| | Now issues the E_STRICT and E_NOTICE time zone |
| | errors. |
| | |
+--------+---------------------------------------------------+
EXAMPLES
Example #1
idate(3) example
<?php
$timestamp = strtotime('1st January 2004'); //1072915200
// this prints the year in a two digit format
// however, as this would start with a "0", it
// only prints "4"
echo idate('y', $timestamp);
?>
SEE ALSO date(3), getdate(3), time(3).
PHP Documentation Group IDATE(3)