NamePros
Welcome, Guest! Ready to make a name for yourself in the domain business? We welcome both the hobbyist and professional domainer to join the discussion as part of the NamePros community.

Click here to create your profile to start earning reputation for posting, and trader ratings for buying & selling in our free e-marketplace. Build your trader rating with each successful sale. Our system has tracked over 100,000 sales and counting!
FAQ & TOS Register Search Today's Posts Mark Forums Read

Go Back   NamePros.com > Website Development Discussion Forums > Programming
Reload this Page How would I do this?

Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics.

Advanced Search


Closed Thread
 
LinkBack Thread Tools
Old 11-04-2005, 04:32 PM THREAD STARTER               #1 (permalink)
Senior Member
 
JoshHendo's Avatar
Join Date: Apr 2005
Location: Australia
Posts: 1,092
JoshHendo is a jewel in the roughJoshHendo is a jewel in the roughJoshHendo is a jewel in the rough
 



How would I do this?


Hello. Does anyone know how I would go about getting the date from the previous day in PHP? I can get the current days date using:
$date = date("dmY");
(that is the format that I want it)
though if i wanted yesturdays date, that would be harder to get becuase the days system isn't based on 100 (grr to whoever made the date system ). If anyone could help me that would be great

(eg. If i tried 03112005 - 1 it would = 03112004 )

---

I tried: $yesturday = mktime(0, 0, 0, date("m") , date("d")-1, date("Y"));
though that didn't work the way I wanted :'(
__________________
:bingo: :kickass: :lala: :notme: :great: :gn:
JoshHendo is offline  
Old 11-04-2005, 06:44 PM   #2 (permalink)
NamePros Regular
 
Jamison54's Avatar
Join Date: Jan 2005
Location: Milwaukee, WI
Posts: 305
Jamison54 will become famous soon enoughJamison54 will become famous soon enough
 



This will work for you:
Code:
<?php
$date = date("dmY", time()-86400);
?>
Or:
Code:
<?php
$date = date("dmY", time()-(60*60*24));
?>
The second bit of code is 60 seconds times 60, which equals one hour, then that one hour times 24 - which is one day.
Jamison54 is offline  
Closed Thread


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


Liquid Web Smart Servers  
All times are GMT -7. The time now is 07:38 PM.

Managed Web Hosting by Liquid Web
Domain name forum recommended by Domaining.com Powered by: vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.6.0 Ad Management plugin by RedTyger