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
Old 07-12-2006, 04:40 PM getdate() past
SlayersOtaku's Avatar
Skilled Talker

Posts: 77
Name: Joe
Location: Oklahoma, USA
Trades: 0
I'm trying to take a time string (2006-07-11) and find a month before (2006-06-11) and several other times. How can I create the comparitive string? I'm having a hardtime figuring it out with date(), everytime I try to minus time it literally looses the date.
__________________

SlayersOtaku is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 07-13-2006, 12:24 AM Re: getdate() past
Ultra Talker

Posts: 256
Location: Auckland, New Zealand
Trades: 0
Hey SlayersOtaku,

I am not sure what you're asking but the easiest way is to use strtotime.

For example, if I wanted to know what last Month is from today, I would do:

PHP Code:
<?php
$lastMonth 
strtotime('last Month');
echo 
date('Y-m-d'$lastMonth);
?>
and the results should be this year, last month, this day.

Alternatively this is the same as doing:

PHP Code:
$lastMonth strtotime('-1 Month'); 
Maybe that's what you're after?

If it's not, then provide examples of what you've been trying so I can get an idea.

Cheers,

MC
__________________
#------------------------------signature---------------------------------------------------------------------------------#
Quote:
I am well recognised for what I don't do than what I do. Chores are just one of those things.

Last edited by mastercomputers; 07-13-2006 at 12:32 AM..
mastercomputers is offline
Reply With Quote
View Public Profile Visit mastercomputers's homepage!
 
Old 07-13-2006, 10:59 AM Re: getdate() past
SlayersOtaku's Avatar
Skilled Talker

Posts: 77
Name: Joe
Location: Oklahoma, USA
Trades: 0
I wasn't real sure the best way to ask it, probably over stated. Anyways that's exactly what I needed. Thanks!
__________________

SlayersOtaku is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to getdate() past
 

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.11964 seconds with 12 queries