What is vldPersonals?

vldPersonals is a very easy to use dating/social software. It allows you to create a fully functioning & modern dating website in a matter of minutes. If You think it's too complicated - check vldPersonals!
Know more about how You can become a dating website owner

What is vldCrowd?

vldCrowd.com is the biggest unofficial community of vldPersonals owners. It is a place to share ideas and thoughts about Your dating website. It is a place to answer questions and receive answers.
Do You own a vldPersonals license? Don't hesitate and join!

Connect Today

Community members help each other to take their dating websites to the next level. Can You make your vldPersonals website better? Join and find out...

Connect With More Than 700 Dating Website Owners! Sign Up Today

Today, Yesterday, 07/07/2009

06/18/2009 09:07 AM
5582 1 2
Applicable to vldP version 2.5.*
You probably noticed that we have human friendly dates formatting here.
You can get the same to your websites if you take my get_date function code and replace the one you have in your /misc/fns.misc.php:

function get_date($timestamp, $format = "date")
        global $SESSION;
        $diff = $SESSION->conf['timezone']*60;
        $datetime = $timestamp - (date("Z") - $diff) + (date("I") ? 3600 : 0);
        $date = $SESSION->conf['timeformat'] ? date("m/d/Y", $datetime) : date("d/m/Y", $datetime);
        $now = time();
        $now = $now - (date("Z") - $diff) + (date("I") ? 3600 : 0);
        $today = $SESSION->conf['timeformat'] ? date("m/d/Y", $now) : date("d/m/Y", $now);
        $yesterday = $SESSION->conf['timeformat'] ? date("m/d/Y", $now-86400) : date("d/m/Y", $now-86400);
        if ($date == $today)
                $date = 'Today';
        else if ($date == $yesterday)
                $date = 'Yesterday';
        if ( $format == "date" ) {
                return $date;
        elseif ( $format == "time" ) {
                return ($SESSION->conf['timeformat'] ? date("h:i A", $datetime) : date("H:i", $datetime));
        elseif ( $format == "rss" ) {
                date("r", $datetime);
        elseif ( $format == "full" ) {
                return $date.' ' . ($SESSION->conf['timeformat'] ? date("h:i A", $datetime) : date("H:i", $datetime));
// End function

This solution can be multi-language friendly if you use $LANG['core']['today'] instead of just 'Today'.
But don't forget to add $LANG to the 'global $SESSION' line.
By the way, you can set more appropriate date formatting for your country by using, for example, "d.m.Y" instead of "d/m/Y" inside this function if it's ok for you.



  • Posted on 07/16/2010 12:22 PM
Any idea how to add it in the CP? Because there I know somebody was here today, but I need to know the hour :-)


  • Posted on 06/18/2009 09:59 AM
good tutorial ... thanks a lot ...

Log in to leave a comment