Perhap a date difference will help, PHP doesn't have this feature, date_diff() while C/C++ have this feature. So, there is a way, you can use the date() function and get the day difference. So, if you have one day difference, you use the if statement or switch statement to use the word 'Yesterday'. For 'Last Week', I don't know because it is a little tricky. :-) Someone else may know of something better than I do.
Scott "Richard Davey" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Hi, > > I'm just wondering if anyone knows of a class/function (or easy way) > to do the following: > > At the moment I display dates like this: > > Last message received: 30th Nov 2003 16:07 > > This is fine, but I would like to make them more friendly like so: > > Last message received: Yesterday, 16:07 > > I would ideally like to have the ranges "Today, Yesterday, This Week, Last > Week" and beyond that I'll use the method above. > > I know how to actually do this from a code point of view, but think it > must be a quite general sort of task and am all for not re-inventing > the wheel here if someone knows/has a quick way to do this? > > -- > Best regards, > Richard mailto:[EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php