Free, Web Based Project Management with CreativePro Office

Forum Home | Miscellaneous Topics

Forum Time

SebyM
2007-05-04 16:10:40
my last post shows:
Projects and Tasks 2 5 2007-05-04 14:04:21SebyM

the time here is 23:04. a little help would be:
Option#1 set the time when saving the posts to GMT time, then show the time when showing the posts in GMT + users timezone. (<< this means old posts will be shown wrong)
Option #2 show the posts in server timezone -> users timezone (<< also fixes old posts)
assuming you use an SQL server as database support, you could use these:
select `bla`,`bla2`,CONVERT_TZ(`timeofpost`,old_tz,new_tz); replace old_tz with server timezone and the new_tz with users timezone (from profile).
SebyM
2007-05-04 16:21:15
oh, i forgot, if you use unix timestamps to save `timeofpost` then:
$usertimezoneofset = GMT-users_profile_timezone
$servertimezoneoffset=GMT-server_timezone_offset
- user php::timezone_offset_get() for the two above, then
$showntimeofpost=date("Y-m-d h:i:s", $row[`timeofpost`]-abs($servertimezoneoffset)+$usertimezoneofset).
jdenton
2007-05-05 12:27:21
I've seen a lot of forums that simply post the time as "2 hours ago" or "Yesterday" or "Last week". I'm not sure which I prefer...and actual time/date or relative time/date. Either way, I'm not really happy with the current timestamp situation so I'll give this more thought. Thanks for the sample code SebyM.