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 > CODE
Reload this Page comparing dates British style

CODE This forum is for posting code snippets and example scripts that aren't quite tutorials, but could be useful for others. You may post code snippets and/or completed scripts that you've written and want to share here.

Advanced Search
7 members in live chat ~  


Closed Thread
 
LinkBack Thread Tools
Old 05-18-2010, 11:24 AM THREAD STARTER               #1 (permalink)
NamePros Regular
 
asgsoft's Avatar
Join Date: Sep 2005
Location: At Home
Posts: 881
asgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of light
 



comparing dates British style


Hey everyone!

This problem has been baffling me all day today.

I am trying to compare dates which are in the British format to see if they are bigger and/or smaller than todays date.

This is what I am using:

PHP Code:
if($start <= date("d/m/Y") && $end >= date("d/m/Y")){
????: NamePros.com http://www.namepros.com/code/657053-comparing-dates-british-style.html
bla;

What this should do is compare and see if todays date falls between the $start and $end

Where am I going wrong?
asgsoft is offline  
Old 05-18-2010, 11:32 AM   #2 (permalink)
Domains my Dominion
 
sdsinc's Avatar
Join Date: Aug 2005
Location: Web 1.0
Posts: 9,955
sdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatness
 


Third World Education Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Animal Rescue Animal Cruelty AIDS/HIV Animal Rescue Wildlife Breast Cancer Animal Rescue Wildlife
The date function returns a formatted string. For the purpose of comparison I would use Unix timestamps (numbers) for example.

There are several functions that can help you achieve the intended purpose...
PHP: DateTime::diff - Manual
PHP: mktime - Manual
__________________
NameNewsletter.com - free lists of available domain names
ZoneFiles.net (beta) - ccTLD and gTLD droplists
sdsinc is offline  
Old 05-18-2010, 11:45 AM   #3 (permalink)
NamePros Regular
 
demaxxus's Avatar
Join Date: Jul 2007
Posts: 323
demaxxus is a splendid one to beholddemaxxus is a splendid one to beholddemaxxus is a splendid one to beholddemaxxus is a splendid one to beholddemaxxus is a splendid one to beholddemaxxus is a splendid one to beholddemaxxus is a splendid one to behold
 



PHP: strtotime - Manual
demaxxus is offline  
Old 05-18-2010, 03:32 PM   #4 (permalink)
NamePros Expert
 
Peter's Avatar
Join Date: Nov 2003
Location: Scotland
Posts: 5,074
Peter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond reputePeter has a reputation beyond repute
 


Child Abuse Save The Children Save The Children Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009 Help The Homeless - Holiday 2009
Originally Posted by demaxxus View Post
PHP: strtotime - Manual
TBH sdsinc response is what the OP should follow. The problem with strtotime is that it sometimes has to guess on the possible expected outcome.
????: NamePros.com http://www.namepros.com/showthread.php?t=657053

As the format is known it is a simple task for the op to change the time into a unix timestamp. If you use strtotime you may end up with unexpected results.
__________________
Manage your portfolio using my new Domain Portfolio Management script.
Securing Your Domain Name From Theft
Peter is offline  
Old 05-20-2010, 04:48 PM THREAD STARTER               #5 (permalink)
NamePros Regular
 
asgsoft's Avatar
Join Date: Sep 2005
Location: At Home
Posts: 881
asgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of lightasgsoft is a glorious beacon of light
 



So what do you recommend peter?
asgsoft is offline  
Old 05-21-2010, 12:54 AM   #6 (permalink)
Domains my Dominion
 
sdsinc's Avatar
Join Date: Aug 2005
Location: Web 1.0
Posts: 9,955
sdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatnesssdsinc Has achieved greatness
 


Third World Education Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Find Marrow Donors! Animal Rescue Animal Cruelty AIDS/HIV Animal Rescue Wildlife Breast Cancer Animal Rescue Wildlife
How do you assign the $start & $end variables ?
__________________
NameNewsletter.com - free lists of available domain names
ZoneFiles.net (beta) - ccTLD and gTLD droplists
sdsinc is offline  
Old 05-21-2010, 04:17 PM   #7 (permalink)
The MINISITE King
 
barefoottech's Avatar
Join Date: May 2005
Location: QTHR
Posts: 4,594
barefoottech has a reputation beyond reputebarefoottech has a reputation beyond reputebarefoottech has a reputation beyond reputebarefoottech has a reputation beyond reputebarefoottech has a reputation beyond reputebarefoottech has a reputation beyond reputebarefoottech has a reputation beyond reputebarefoottech has a reputation beyond reputebarefoottech has a reputation beyond reputebarefoottech has a reputation beyond reputebarefoottech has a reputation beyond repute
 


Cystic Fibrosis Diabetes Breast Cancer Save a Life
Originally Posted by asgsoft View Post
Hey everyone!
????: NamePros.com http://www.namepros.com/showthread.php?t=657053

Where am I going wrong?
Trying to program when you don't know how!

Read, than re-read the documentation for time & date PHP functions .
Try a few little examples. When you are comfortable with them, then and only then, try using them in a larger program.
__________________
Studio51 Sites!
Often Copied
Always Amazing
Never Bettered.
Last edited by barefoottech; 05-21-2010 at 04:37 PM.
barefoottech is offline  
Closed Thread


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


 
All times are GMT -7. The time now is 07:34 PM.

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