Go to Post Is all your information based on hearsay and miscellaneous posts by other people that don't know what they are talking about? - dlavery [more]
Home
Go Back   Chief Delphi > Technical > IT / Communications > Website Design/Showcase
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #2   Spotlight this post!  
Unread 11-03-2006, 11:06
evulish's Avatar
evulish evulish is offline
1010100
AKA: Grant Harding
#0084 (WATTNESS (bot: Chuck))
Team Role: Alumni
 
Join Date: Jul 2002
Location: Towanda/Wysox, PA
Posts: 1,434
evulish is just really niceevulish is just really niceevulish is just really niceevulish is just really nice
Send a message via AIM to evulish
Re: Logic Question

Is there any reason you can't store time() instead? If you need the d/m/y out of it later, you could use date() then.

Otherwise, the simplest way would be to use:

PHP Code:
if (strtotime("$itemE_month/$itemE_day/$itemE_year $itemE_hour:$itemE_minute $itemE_ampm") > time()) { echo "yup"; } 
It's more intensive than checking the logic but it's far simpler.

PHP Code:
if ($item_year $year) { echo "yes"; }
if (
$item_year == $year) {
  if (
$item_month $month) { echo "yes"; }
  elseif (
$item_month == $month) {
    if (
$item_day $day) { echo "yes"; }
    elseif (
$item_day == $day) {
      if (
$item_hour $hour) { echo "yes"; }
      elseif (
$item_hour == $hour) {
        if (
$item_minute $minute) { echo "yes"; }
      }
    }
  }

Another way would be:

PHP Code:
$old = array(
$item_year,
$item_month,
$item_day,
$item_hour,
$item_minute
);

$new = array(
$year,
$month,
$day,
$hour,
$minute
);

function 
compare_dates($old$new) {

for (
$i=0;$i<4;$i++){
if (
$old[$i] < $new[$i]) { return "no"; }
if (
$old[$i] > $new[$i]) { return "yes"; }
}

return 
"equal";
}

echo 
compare_dates($old$new); 
__________________
I'm a professional web developer. I'm good with PHP, Perl, Java/JSP, some RoR, XML, Javascript (AJAX as well), (x)HTML, CSS, etc.. Validated code is good; fully cross-browser code is better (you comply to your users and the software they use, not the other way around. Sorry!)

Last edited by evulish : 11-03-2006 at 11:13.
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Important question regarding starting position of balls in the BOT Nimmy Rules/Strategy 2 12-02-2006 17:17
Question of the Week!!! (6/14/04) Andy Grady General Forum 23 01-07-2004 15:54
Question of the Week [05-02-04]: The Very Merry Month of May EddieMcD Rumor Mill 10 05-05-2004 14:02
Why I hate Logic EnderofDragon Chit-Chat 2 19-02-2002 21:02


All times are GMT -5. The time now is 23:54.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi