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.

Years, Months, Days, etc.

Old posts that have not been replied to for several years.
Locked
c
cvanmeer
Halfop
Posts: 40
Joined: Tue Dec 02, 2003 1:00 pm
Location: The Netherlands
Contact:

Years, Months, Days, etc.

Post by cvanmeer »

Hi All,

I'm trying to put together a script that returns the number of years, months, days, hours, etc. from a certain date. I've searched the forum, there are a few posts that come close to what I want, but I can't seem to make it work.

I want to make a script where I set the 'from-date' in a variable (ie. June, 30th 2002) and calculate the date difference to now and output it to the channel like: "# years, # monts, # days, # hours, # seconds have passed since $fromdate"

Could somebody help me?

thx.

Chrizz
User avatar
strikelight
Owner
Posts: 708
Joined: Mon Oct 07, 2002 10:39 am
Contact:

Post by strikelight »

Look for "duration" in tcl-commands.doc
c
cvanmeer
Halfop
Posts: 40
Joined: Tue Dec 02, 2003 1:00 pm
Location: The Netherlands
Contact:

Post by cvanmeer »

thx...this worked:

Code: Select all

set diff [duration [expr [clock seconds] - [clock scan $since]]]
Locked