[advanced search]
 

Go Back   NamePros.com > Discussion > Web Design & Development > Programming

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


Closed Thread
 
LinkBack Thread Tools
Old 11-04-2005, 03:32 PM   #1 (permalink)
Senior Member
 
JoshHendo's Avatar
 
Join Date: Apr 2005
Location: Australia
Posts: 1,099
48.40 NP$ (Donate)

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, 05:44 PM   #2 (permalink)
NamePros Regular
 
Jamison54's Avatar
 
Join Date: Jan 2005
Location: Milwaukee, WI
Posts: 279
2.25 NP$ (Donate)

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

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 On
Pingbacks are On
Refbacks are On


Site Sponsors
Advertise your business at NamePros

All times are GMT -7. The time now is 11:24 PM.


Powered by: vBulletin® Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0
Template-Modifications by TMS
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85