generate unix timestamp from last time
Posted
by Nazmin
on Stack Overflow
See other posts from Stack Overflow
or by Nazmin
Published on 2010-04-29T08:38:15Z
Indexed on
2010/04/29
9:07 UTC
Read the original article
Hit count: 382
hi guys,
suppose i have one column in mysql database which is stated last time one equipment is up in h:i:s format (ex: 00:05:11) or 1d21h, means that the equipment is on since 5 min before, what is the best method i can convert this to unix timestamp, say if using php script how? or direct convert last unix timestamp using mysql function query.
actually, i want to calculate for start time for this equipment uptime in unix timestamp where i have one column in mysql startcapture that will be deducted with last column to get start time. so starttime = startcapture - last (this last time that has to convert to unix timestamp based on now() - h:i:s ). but the problem is sometimes the format change from h:i:s to ex: 1d22h, if h:i:s means the equipment is up since ex: 00:05:11 min before and if 1d22h means the equipment already up 1 day 22 hours before.
so the main things here is to convert last column to appropriate unix timestamp.
please help guys, asap.
© Stack Overflow or respective owner