WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Get a futurist date from today date to your adding date
Categories : PHP, PHP Classes, Date Time Click here to Update Your Picture
naifphp naif php
Date : Aug 22nd 2006
Grade : 5 of 5 (graded 2 times)
Viewed : 4214
File : 4485.zip
Images : Image 1
Search : More code by naifphp naif php
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

- use this class when you want getting a futurist date from today date to date added by you.

- you can add one day or month or year or more or all of them , as you like .

- it can help you to get unix format date , when using ads system deleting automatically after same date you can use unix format .

- it results a difference day,month and year from today date to a futurist date .

GetFuturistDate.class.php
<?php

/*
//------------------------------------------------------------------------------------------------------------
|| @ Script Desc  : Get a futurist date from today date to your adding date
|| @ Version      : 1.0 beta
|| @ Created      : NAIF PHP
|| @ Web Site     : www.naifphp.net
|| @ Date Created : 22 - 8 - 2006
//--------------------------------------------------------------------------------------------------------------
*/


Class GetFuturistDate
{

      var
$date_format = "d / m / Y"; // date formatting day / month / year
     
var $_day        = "0"; // set day
     
var $_month      = "0"; // set month
     
var $_year       = "0"; // set year


     
function FuturistDate($d="0", $m="0", $y="0")
      {
             
$d  = intval (str_replace('-','',$d));
             
$m  = intval (str_replace('-','',$m));
             
$y  = intval (str_replace('-','',$y));

             
$this->_day     = $d;
             
$this->_month   = $m;
             
$this->_year    = $y;

             
$convert = strtotime("$d days $m months $y years ");

              if (
$convert == '-1')
              {
                      die (
"error , in adding date !!");
              }
              else
              {

                     
$ToDay = date("$this->date_format");
                     
$DateToDayInfo = explode('/', $ToDay);

                     
$_FuturistDate = date("$this->date_format", $convert);
                     
$GetFuturistDate = explode('/',$_FuturistDate);

                     
$balance['day']    = str_replace('-','',$GetFuturistDate[0] - $DateToDayInfo[0]);
                     
$balance['month']  = str_replace('-','',$GetFuturistDate[1] - $DateToDayInfo[1]);
                     
$balance['year']   = str_replace('-','',$GetFuturistDate[2] - $DateToDayInfo[2]);


                     
$FuturistDate = array(

                             
/* Output Date '1176843600' */
                             
"UNIX"          =>    $convert,

                             
/* Outputd Futurist Date ' 22 / 8 / 2006' */
                             
"FUTURISTDATE"  =>    $_FuturistDate,

                             
/* Output balance days */
                             
"BDAY"          =>    $balance['day'],

                             
/* Output balance months */
                             
"BMONTH"        =>    $balance['month'],

                             
/* Output balance Years */
                             
"BYEAR"         =>    $balance['year'],

                             
/* Output ToDay Date */
                             
"TODAY"         =>    $ToDay

                             
);

              }

          return
$FuturistDate;

      }
}
?>



Example Usage
<?php

/*
//------------------------------------------------------------------------------------------------------------
|| @ Script Desc  : Get a futurist date from today date to your adding date
|| @ Version      : 1.0 beta
|| @ Created      : NAIF PHP
|| @ Web Site     : www.naifphp.net
|| @ Date Created : 22 - 8 - 2006
//--------------------------------------------------------------------------------------------------------------
*/


include_once ("GetFuturistDate.class.php");

if(! isset (
$_GET['action'] ) )
{

echo
"<title> Example : Get Futurist Date Class </title>".
         
"<h2> Please insert the day , month and year to get a futurist date   </h2>".
         
"Note : Leave any column blank if you don't want to add it .".

         
"<form method=\"get\">".
         
"Day(s) : <BR><input type=\"text\" name=\"d\" ><BR>".
         
"Month(s) : <BR><input type=\"text\" name=\"m\"><BR>".
         
"Year(s) : <BR><input type=\"text\" name=\"y\"><BR>".
         
"<input type=\"hidden\" name=\"action\"><BR>".
         
"<input type=\"submit\" value=\"Get Futurist Date\"></form>";


}
else
{

$d = $_GET['d'];
$m = $_GET['m'];
$y = $_GET['y'];

$obj = new GetFuturistDate();

// extracting all information :)
$my_date         = $obj->FuturistDate($d, $m, $y);

$today           = $my_date["TODAY"];
$futu_date       = $my_date["FUTURISTDATE"];
$date_unix       = $my_date["UNIX"];
$balance_day     = $my_date["BDAY"];
$balance_month   = $my_date["BMONTH"];
$balance_year    = $my_date["BYEAR"];


echo 
"ToDay Date is : " . $today ." <br> \n".
         
"My Futurist Date After ". $d ."day , ". $m ." month ,". $y ."year is : ".$futu_date.
         
"\n<br> My Futurist Date UNIX formatting : ". $date_unix ." <br>\n".
         
" day's difference : ". $balance_day ." , month : ". $balance_month ." , year : " . $balance_year.

         
"\n <br><br><a href=\"?\"> Try Again </a>";

}

?>



Validator - A PHP class that can can be used for validating Email IDs and Dates
Categories : PHP, PHP Classes, Data Validation, Email, Date Time
A Timing Class
Categories : PHP, PHP Classes, Date Time
Open and Close your website in fixed times .
Categories : PHP, PHP Classes, Cron, Date Time
A time measuring and performance benchmarking class
Categories : PHP, PHP Classes, Testing, Debugging, Date Time
A PHP Calendar function with CSS : add a cool calendar to any php page by just adding a calendar class based function.
Categories : PHP, PHP Classes, Calendar, Date Time
pcCalendar class - Allows for the creation of calendars in HTML pages. All output functions can be easily overridden, refer to article 1471 for an example.
Categories : PHP, Date Time, Calendar, PHP Classes
a class that uses microtime() to provide easy calculation of elapsed times
Categories : Date Time, PHP, PHP Classes
Example of using the pcCalendar class, article 1468 on weberdev.com. Calendar example.
Categories : PHP, Date Time, PHP Classes, Calendar
Bs_StopWatch is a class to measure time intervals in microseconds.
Categories : PHP, Date Time, PHP Classes
Customizable Calendar Class
Categories : HTML and PHP, Date Time, PHP, PHP Classes, Calendar
Functions used to define a schedule of holidays. Can define non-fixed holidays (eg. 3rd sunday of June).
Categories : Calendar, Date Time, PHP
Class to Create protected URLs
Categories : PHP, PHP Classes, URLs
Form is a utility class for generating html forms. It provides form initialization and regex based data validation (both server and client side) with a convenient interface. This version obsoletes version 1.0a
Categories : HTML, PHP, PHP Classes, Regexps
shopping cart class with add/edit/delete product functionality.
Categories : PHP, PHP Classes, Ecommerce
HTML_Graphs provides a simple PHP interface for creating pure HTML charts.
Categories : Graphics, PHP, PHP Classes, Charts and Graphs