Current location: Hot Scripts Forums » Programming Languages » PHP » adding date and time in mysql


adding date and time in mysql

Reply
  #1 (permalink)  
Old 11-26-04, 09:25 PM
darkcarnival's Avatar
darkcarnival darkcarnival is offline
PHP/MySQL coder
 
Join Date: Jun 2003
Location: Michigan
Posts: 939
Thanks: 0
Thanked 0 Times in 0 Posts
adding date and time in mysql

hi,

im making a forum and i want to store the posted date and time but i do not do both in 1 row. can i add currdate and currtime together?

thx in advance.
__________________
Elite Bulletin Board
http://elite-board.us
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 11-27-04, 04:56 AM
<?Wille?> <?Wille?> is offline
Junior Code Guru
 
Join Date: Jan 2004
Location: Helsinki, Finland
Posts: 666
Thanks: 0
Thanked 0 Times in 0 Posts
in the forum im doing i store the unix timestamp ( time() ) and then when i display it i use date().. this way you can have the forum to show times in userdefined format and in their own time zone
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 11-27-04, 09:50 AM
darkcarnival's Avatar
darkcarnival darkcarnival is offline
PHP/MySQL coder
 
Join Date: Jun 2003
Location: Michigan
Posts: 939
Thanks: 0
Thanked 0 Times in 0 Posts
hmm ok though im confused on how i can convert time() into date().

could you show me?
__________________
Elite Bulletin Board
http://elite-board.us
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 11-27-04, 10:26 AM
Acecool's Avatar
Acecool Acecool is offline
Aspiring Coder
 
Join Date: Nov 2003
Posts: 506
Thanks: 0
Thanked 0 Times in 0 Posts
date("Properties", time());
__________________
Check Acecoolco.com for PHP Tutorials, and other tuts
If you plan on contacting me, please read this: Legal Terms & Conditions
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 11-27-04, 01:10 PM
<?Wille?> <?Wille?> is offline
Junior Code Guru
 
Join Date: Jan 2004
Location: Helsinki, Finland
Posts: 666
Thanks: 0
Thanked 0 Times in 0 Posts
right.. the idea was to insert the timestamp..
$time = time();
insert into table set field="somevalue", dateformat="d m Y", time="$time"

and then when you show it you do
$query
$r = mysql_fetch_array
echo date($r['dateformat'], $r['time'])

awfully shortend and stuff but you get the idea right?
when a user registers he gets to choose how to show the time..
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #6 (permalink)  
Old 11-27-04, 01:41 PM
darkcarnival's Avatar
darkcarnival darkcarnival is offline
PHP/MySQL coder
 
Join Date: Jun 2003
Location: Michigan
Posts: 939
Thanks: 0
Thanked 0 Times in 0 Posts
ok cool thx guys
__________________
Elite Bulletin Board
http://elite-board.us
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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 Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
inserting and retrieving date and time from mysql database stealth04 PHP 5 07-29-04 12:19 PM
date time fields are they really NULL? sky4est PHP 1 03-29-04 01:59 PM
help regarding insertion of date time wajeeh_r ASP 1 03-04-04 05:05 PM
I am not getting time even i set date propery to date/time skchakri ASP 3 09-30-03 05:47 PM
Days left to certain date. Data from MySQL alfreds PHP 4 06-17-03 10:26 AM


All times are GMT -5. The time now is 10:18 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.