Page 1 of 1

Time / Date Handling

Posted: Wed Apr 22, 2009 2:17 pm
by thisbl00d
im trying to build a script that keeps a Log of events. the log has the following fields

(postname, post_time , post_id)

when a post is made i call the function below

Code: Select all

function create_date()
{
    $today = date("D M d, Y H:i:s"); 
    $format = $today;
    return $format;
}
 
and then

Code: Select all

$post_time = create_date();
$post_time is inserted into MySql DataBase.

Now how shud i retrieve / display the post_time variable with the actual time of post ?
There is no need of TimeZone functionality for this script because the script will be used Locally only. Any suggestions or examples will be helpful

Re: Time / Date Handling

Posted: Thu Apr 23, 2009 10:12 am
by pickle
A simple SELECT sql statement will pull it back out. Maybe I'm missing the point of the post.

Why do you store the date in 2 separate variables in your create_date() function? It's completely unnecessary:

Code: Select all

function create_date(){
    return date("D M d, Y H:i:s"); 
}

Re: Time / Date Handling

Posted: Sun Apr 26, 2009 12:01 am
by thisbl00d
:lol: i was trying some stuff with the code. removed a few lines between the 2 variables. anyway, my problem i solved myself