Jump to content

How would you...


rhyno

Recommended Posts

I need to figure out if an entered date has occured in the past... eg) I want to meet with you on this date: 2008/02/05 but todays date is 2008/02/12 would you do something like this?

if($_SESSION['contact_array']['meeting_date'] <= getdate()){
then no meeting;
}else {
proceed with the meeting;}

Link to comment
Share on other sites

Those values are strings, and won't really compare. I would recommend working with timestamps

 

<?php
$_SESSION['contact_array']['meeting_date'] = strtotime('2/14/2008 1:00PM EST'); //This is a timestamp of 1203012000

if($_SESSION['contact_array']['meeting_date'] < time()){ //time() returns the current time as a timestamp
  //then no meeting;
}else {
  //proceed with the meeting
}
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.