skard Posted February 15, 2008 Share Posted February 15, 2008 Hi. I'm not a programmer, so i hope it doesnt seem rude my asking for help here. Is it allowed? I run a site built in php and often can't get hold of a programmer so try and change little bits myself, usually by finding other bits of code around my site that do a similiar job, and then copying and modifying them. Something i've been trying to do, but I'm completely lost with it, is this: I have a forum, and on the latest posts page it looks something like this - Last Post: 14th February 2008 16:02 by John Doe Now the code that prints the date part (14th Febuary 2008 16:02) is the following: $content .= $tmp->LastPost->DateFormatted; I'm trying to get it to not just print the date, but if the post was made yesterday, then print: Last Post: Yesterday at 16:02 by John Doe or if it was made today, then: Last Post: Today at 16:02 by John Doe A friend of mine changed it to this: $content .= ((mktime() - $tmp->LastPost->Date < 86400) ? 'Today' : $tmp->LastPost->DateFormatted); Which works to some degree as the final output is this: Last Post: Today by John Doe but it doesnt show the time the post was made, and its not actually 'today' but in the last 24 hours, which isnt what i want. Can anyone help? Much appreciated if someone can Thanks in advance for any help Quote Link to comment Share on other sites More sharing options...
cyrixware Posted February 15, 2008 Share Posted February 15, 2008 Hi... Try to use timestamp in mysql... everytime the updates automaticaly time and date changed.. Regards Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.