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.

time thingy help !

Old posts that have not been replied to for several years.
Locked
P
Psx|Dk
Voice
Posts: 11
Joined: Thu Aug 21, 2003 9:04 am

time thingy help !

Post by Psx|Dk »

Hey all ;)

i extract timestamp from a mysqldb

looks like this 20050426151138

what i need is a way to convert it to following !

if i need to see time after 1½ year
want it to look like this

1y 6m 16h 9m 19s



any there can help me out here !
User avatar
De Kus
Revered One
Posts: 1361
Joined: Sun Dec 15, 2002 11:41 am
Location: Germany

Post by De Kus »

try this:

Code: Select all

clock scan "[string range $sqlstamp 0 7] [string range $sqlstamp 8 end]"
tcl: evaluate (.tcl): clock scan "20050426 151138"
Tcl: 1114524698
tcl: evaluate (.tcl): ctime 1114524698
Tcl: Tue Apr 26 15:11:38 2005
http://www.tcl.tk/man/tcl8.4/TclCmd/clock.htm#M45

reading The Manual gives enlightment :).

for the rest you just need to expr the unixtime stamps and phrase them via the "duration" TCL-Command ;).
De Kus
StarZ|De_Kus, De_Kus or DeKus on IRC
Copyright © 2005-2009 by De Kus - published under The MIT License
Love hurts, love strengthens...
Locked