Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
How Do I Insert date and time into mysql
Old 01-07-2008, 01:58 PM How Do I Insert date and time into mysql
andyp's Avatar
Extreme Talker

Posts: 165
Name: andy patterson
Trades: 0
I'm puzzled how i could insert the current servers date and time into a mysql date/time column how would i do it?.
andyp is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-07-2008, 03:02 PM Re: How Do I Insert date and time into mysql
rogem002's Avatar
PHP Chap

Posts: 843
Name: Mike
Location: United Kingdom
Trades: 0
Put the date into a variable, then put that variable into a MySQL query.

PHP Code:
<?php
$date 
date('l dS \of F Y h:i:s A');
// Put $date into your mysql query.
?>
__________________
My Blog/Site:
Please login or register to view this content. Registration is FREE

Last edited by rogem002; 01-07-2008 at 03:04 PM..
rogem002 is offline
Reply With Quote
View Public Profile Visit rogem002's homepage!
 
Old 01-07-2008, 03:12 PM Re: How Do I Insert date and time into mysql
Ultra Talker

Posts: 251
Location: Belgium, Antwerp, Zoersel
Trades: 0
Or, if you're mysql server is the same as your other server, just do:
Code:
mysql_query('UPDATE your_table SET date_colum = NOW() WHERE condition')
Or you could do
PHP Code:
<?php
$time 
time();
mysql_query("UPDATE your_table SET date_colum = FROM_UNIXTIME($time) WHERE condition");
?>
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
Orodreth is offline
Reply With Quote
View Public Profile Visit Orodreth's homepage!
 
Reply     « Reply to How Do I Insert date and time into mysql
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.22317 seconds with 12 queries