WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
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 Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
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
Submit Site
Forex Trading Online forex trading platform

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 : Convert date's in YYYY-MM-DD (i.e. mysql format) into PHP3 timestamps. Also Find the difference in days between two PHP3 timestamps.
Categories : HTML and PHP, PHP, MySQL, Date Time Update Picture
Robin M.
Date : Oct 06th 1999
Grade : 2 of 5 (graded 6 times)
Viewed : 30649
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Robin M.
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

<?
function GetTimeStamp($MySqlDate)
{
        /*
                Take a date in yyyy-mm-dd format and return it to the user
                in a PHP timestamp
                Robin 06/10/1999
        */
        $date_array = explode("-",$MySqlDate); // split the array
        
        $var_year = $date_array[0];
        $var_month = $date_array[1];
        $var_day = $date_array[2];

        $var_timestamp = mktime(0,0,0,$var_month,$var_day,$var_year);
        return($var_timestamp); // return it to the user
}

function GetDayDiff($ts_1, $ts_2)
{
        /*
                This will return the difference in days between two PHP timestamps
                Robin 06/10/1999
        */
        // calculate which is the larger so we never get negative answers
        if ($ts_1 > $ts_2) {
                // $ts_1 is larger
                $var_days = ($ts_1 - $ts_2) / 86400; /// 60 / 60 / 24;
        } elseif ($ts_1 < $ts_2) {
                // $ts_1 is smaller
                $var_days = ($ts_2 - $ts_1) / 86400; /// 60 / 60 / 24;        
        } else {
                // they must be equal
                $var_days = 0;
        }
        return($var_days); //return the value
}
?>

source : http://www.xs.mw/robin/php.html



Calendar using Date function
Categories : HTML and PHP, PHP, Date Time, Calendar
phpCards - PHP/mySQL postcard script with web based admin to add, edit, and delete cards and categories. Very easy to install.
Categories : PHP, Complete Programs, HTML and PHP, MySQL
Select with current month
Categories : PHP, HTML and PHP, Date Time, Arrays
html split bar used to split in multiple pages a database result
Categories : HTML and PHP, Databases, MySQL, PHP
Automatically printing the contents of an sql table in MySQL.
Categories : MySQL, PHP, HTML and PHP, Databases
Random quote generator using MySQL and PHP. Allows HTML tags inside quotes and features a marker so a sigle quote will not be repeated after consecutive page loads.
Categories : PHP, HTML and PHP, MySQL
Amazon book cover handling
Categories : HTML and PHP, PHP, MySQL, Ecommerce
Complete, simple working example of login screen and check on a unique page using php functions, cookies and mysql database.
Categories : PHP, Cookies, MySQL, HTML and PHP, Authentication
Pull Down Surfing - Surf on Change
Categories : Java Script, MySQL, HTML and PHP, PHP, Databases
Dynamically generated pop-ups (Select items)
Categories : PHP, HTML and PHP, MySQL, Databases
a function that builds an HTML select list from any mysql table.
Categories : PHP, MySQL, HTML and PHP
Message of the Day - Random Message (Needs MySQL!)
Categories : Databases, HTML and PHP, PHP, MySQL
Alternating background color for HTML table rows
Categories : PHP, Databases, MySQL, HTML and PHP
A very simple way to build and do a hierarchical html categories browser without javascript , just using html php and mySql
Categories : HTML and PHP, Databases, Algorithms, PHP, MySQL
Creates three SELECT form fields: Month, Day, and Year. You give it a string which will be used to make the name for the three fields, and a number of seconds to use as the default date. If you give it blank for this value, the current date is used.
Categories : HTML and PHP, PHP, Date Time