MovableBlog: My Time Adjustment PHP Code

Nuance 2.0

March 14, 2003

Here's the code I promised:

For your where you want the blog data, put this code in (modified as
necessary):

<MTEntries>

<div class="<$MTEntryAuthor dirify="1"$>">
<!-- in your CSS, include a class named after each other's name, all in lower case, so that you can differentiate colours and whatnot for each other -->

<p><$MTEntryTitle$></p>

<$MTEntryBody$>
<MTEntryIfExtended>
<p>[<a href="<$MTEntryLink$>#more">read the rest of this
post...</a>]</p></MTEntryIfExtended>
<p class="postedline"gt;Posted by <$MTEntryAuthor$> on <a
href="<$MTEntryLink$>"><?

/* begin time adjustment code */

if ("<$MTEntryAuthor$>" == "Richard") /* replace Richard with your name */
{
$minusHours = (mktime(<$MTEntryDate format="%M, %S, %m, %e, %Y"$>))-3,
/* replace the number 3 with the number of hours behind you are */

print date("M. j \a\\t g:i A", $minusHours);
print " Pacific";
/* replace Pacific with your time zone */
}

else
{
print "<$MTEntryDate format="%b. %e at %l:%M %p"$> Eastern"; /* replace Eastern with the time zone of your co-author's time zone */
}
?></a> <!-- insert your MT comments tags here -->
</div>

</MTEntries>

When I used this code, the time zone for the blog was set to my friend's time zone, even though the blog used my installation of MT. See? Pretty convoluted, huh? Like I said, the scriptygoddesses do it simpler, and besides, this is something I wish MT did internally by itself.

Posted by Richard at 11:03