Current location: Hot Scripts Forums » Programming Languages » PHP » timestamp help


timestamp help

Reply
  #1 (permalink)  
Old 03-18-08, 05:49 PM
vistaboy vistaboy is offline
Newbie Coder
 
Join Date: Mar 2008
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
timestamp help

Okay with the thing i am making i am not 100% sure what would be the best why to work with time so what i want to do is have a day when you buy like for EG : date('Y-m-d', strtotime('+1 month')) and that put in a database and have it like date('Y-m-d') >= $data from database that the best why of doing it or should i do it the way were it makes a lot of numbers?
Reply With Quote
  #2 (permalink)  
Old 03-18-08, 05:52 PM
Jay6390's Avatar
Jay6390 Jay6390 is offline
Code Master
 
Join Date: Apr 2007
Location: United Kingdom
Posts: 1,330
Thanks: 0
Thanked 0 Times in 0 Posts
You should store dates as dates rather than in a unix timestamp. mysql has a number of useful ways of using dates within queries, and should be used if possible
__________________
Useful Tutorials
[ PHP Video-1-2-3 ] [ MySQL 1-2-3 ]
For any php function reference type

www.php.net/FunctionName
Reply With Quote
  #3 (permalink)  
Old 03-18-08, 05:55 PM
vistaboy vistaboy is offline
Newbie Coder
 
Join Date: Mar 2008
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts
So its best to do it the way i said in my EG?
Reply With Quote
  #4 (permalink)  
Old 03-18-08, 05:56 PM
Jay6390's Avatar
Jay6390 Jay6390 is offline
Code Master
 
Join Date: Apr 2007
Location: United Kingdom
Posts: 1,330
Thanks: 0
Thanked 0 Times in 0 Posts
Yes. Have a look at this article from the mysql manual. should provide you with the information you need

Jay
__________________
Useful Tutorials
[ PHP Video-1-2-3 ] [ MySQL 1-2-3 ]
For any php function reference type

www.php.net/FunctionName
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
Select datediff from unix timestamp Nikas Database 1 12-31-07 07:52 AM
Problem with TimeStamp.. bd_coder PHP 5 05-27-06 04:26 AM
Convert timestamp to date with Date::Manip FiRe Perl 1 07-29-05 05:54 AM
comparing timestamp ArksI PHP 2 11-19-04 11:58 AM
select timestamp that doesn't exist in other table jove PHP 0 03-12-04 08:40 AM


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