TCLUG Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [TCLUG:10014] date calulator




You can use perl to do this. The following small program would result
in this output:

	$ ./t
	Now         : Mon Nov 15 22:28:16 1999
	Now - 27640 : Mon Nov 15 14:47:36 1999
	Now + 3400  : Mon Nov 15 23:24:56 1999
	Now - 45days: Fri Oct  1 23:28:16 1999

Here is the perl script:

===================================================================
#!/usr/bin/perl

# define some constants
$minute	= 60;
$hour	= $minute * 60;
$day	= $hour * 24;
$week	= $day * 7;

# get the local time expressed in seconds since 
# the birth of UNIX January 1, 1970, UTC
$now = time;

# print what time it is right now
print "Now         : ", scalar localtime($now), "\n";

# print what time it was 27640 seconds ago
print "Now - 27640 : ", scalar localtime($now - 27640), "\n";

# print what time it will be in 3400 seconds
print "Now + 3400  : ", scalar localtime($now + 3400), "\n";

# print what time it was 45 days ago
print "Now - 45days: ", scalar localtime($now - (45 * $day)), "\n";
===================================================================

Regards

				- Karl


On Thu, 11 Nov 1999, bl155 wrote:

> im looking for a date calculator: ie i have: 27640 seconds ago, what was
> the date:time
> or in 3400 seconds it will be date:time
> or 45 days ago it was date:time.
> does anyone know of an application that does this sort of thing?
> 
> chris engstrom
> bl155@treewax.com
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tclug-list-unsubscribe@mn-linux.org
> For additional commands, e-mail: tclug-list-help@mn-linux.org
>