My center block for recent forum posts uses the unixtime to find the 'last posts' made but im in a different country (and all of my users) to where our site is hosted...
is there any way in this block to add or change something to make it possibly use the forum's timezone? - as that is set to the correct date & time.
i think its somewhere in this piece of code:
Code:
$result3 = sql_query("SELECT poster_id, FROM_UNIXTIME(post_time,'%m/%d/%Y at %H:%i') as post_time FROM ".$prefix."_bbposts where post_id='$topic_last_post_id'", $dbi);
list($poster_id, $post_time)=sql_fetch_row($result3, $dbi);
ive also taken some screen shots of what the time differences are:
(the first pic shows the correct time)
1:
2:
mikem Theme Guru
Joined: Jan 13, 2003
Posts: 1582
Location: Corn fields of Indiana
Posted:
Mon Aug 16, 2004 11:42 am
This is as close as I can get it.
change this part
Code:
post_time,'%m/%d/%Y at %H:%i'
to this
Code:
post_time,'%b %d, %Y at %T'
that will display it as
Jul 29, 2004 at 16:34:56 better than what it was.
The time will stay at military, I do not know how to alter that. The time zones in the Forums don't matter. The block will display the time that the post was made, which is correct on your two images. Just one is Standard time and the other Military.
I finally find it out, its now very simple, add this in:
FROM_UNIXTIME(post_time +32400,'%b %d, %Y at %T')
+32400 is + 9 hours (3600x9=32400),
just multiply 3600 with number of hours, and you'll get your GMT, and add it after post_time
Its really working! Yeah!
Mael Nuke Cadet
Joined: Feb 23, 2004
Posts: 3
Posted:
Tue Sep 27, 2005 7:36 am
mikem wrote:
Jul 29, 2004 at 16:34:56 better than what it was.
The time will stay at military, I do not know how to alter that. The time zones in the Forums don't matter. The block will display the time that the post was made, which is correct on your two images. Just one is Standard time and the other Military.
To change the time from military time to a 12 hour format change
%b %d, %Y at %T
to
%b %d, %Y at %r
Here are the possible variables
%% PERCENT
%a day of the week abbr
%A day of the week
%b month abbr
%B month
%c MM/DD/YY HH:MM:SS
%C ctime format: Sat Nov 19 21:05:57 1994
%d numeric day of the month, with leading zeros (eg 01..31)
%e numeric day of the month, without leading zeros (eg 1..31)
%D MM/DD/YY
%G GPS week number (weeks since January 6, 1980)
%h month abbr
%H hour, 24 hour clock, leading 0's)
%I hour, 12 hour clock, leading 0's)
%j day of the year
%k hour
%l hour, 12 hour clock
%L month number, starting with 1
%m month number, starting with 01
%M minute, leading 0's
%n NEWLINE
%o ornate day of month -- "1st", "2nd", "25th", etc.
%p AM or PM
%P am or pm (Yes %p and %P are backwards
%q Quarter number, starting with 1
%r time format: 09:05:57 PM
%R time format: 21:05
%s seconds since the Epoch, UCT
%S seconds, leading 0's
%t TAB
%T time format: 21:05:57
%U week number, Sunday as first day of week
%w day of the week, numerically, Sunday == 0
%W week number, Monday as first day of week
%x date format: 11/19/94
%X time format: 21:05:57
%y year (2 digits)
%Y year (4 digits)
%Z timezone in ascii. eg: PST
%z timezone in format -/+0000
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum