This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Calculate Date

Help for those learning Tcl or writing their own scripts.
Post Reply
User avatar
CoMMy
Halfop
Posts: 99
Joined: Thu Jul 24, 2003 1:03 am
Location: Cyprus

Calculate Date

Post by CoMMy »

Hi,

I need some coding info regarding the use of date.
Basically what i need is to get some variables of a date example:
set minutes 6
set 24hour 14
set day 10
set month 12
set year 2006

And then i want the script to calculate the remaining time from today untill that date in this format:
Years,Months,Days,Hours,Minutes

a 0 should be shown only where it is not applicable. Example 2006 to 2006 is 0 years.


Any ideas how to implement this? Maybe someone has a script ready for this ? I have found a Datestill.tcl but i cant make it work like i want :S


Thanks for help:)
(c) CoMMy (c)
Resistance is Futile!!
We Are The Borg!!
User avatar
Sir_Fz
Revered One
Posts: 3794
Joined: Sun Apr 27, 2003 3:10 pm
Location: Lebanon
Contact:

Post by Sir_Fz »

Code: Select all

set duetime [clock scan "mm/dd/yy hh:mm:ss"]

set duration [duration [expr {$duetime - [unixtime]}]]
Read about clock scan.
User avatar
CoMMy
Halfop
Posts: 99
Joined: Thu Jul 24, 2003 1:03 am
Location: Cyprus

Post by CoMMy »

a million thanks...

Exactly what i needed:)
(c) CoMMy (c)
Resistance is Futile!!
We Are The Borg!!
Post Reply