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 : Functions that will format a date in either long or short format from a string.
Categories : Date Time, Strings, PHP Update Picture
Michael Stearne
Date : Aug 28th 1998
Grade : 2 of 5 (graded 3 times)
Viewed : 6326
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Michael Stearne
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

/*
Usage: string formatDateS(string);
Input is a string in the format: 19980828
Where the first four digits are the year, the next two are the month, and the
last two are the day.

The function takes the string, breaks it up and reformats in a short
date format, like : 08/28/1998

Usage: string formatDateL(string);
Input is a string in the format: 19980828
Where the first four digits are the year, the next two are the month, and the
last two are the day.

The function takes the string, breaks it up and reformats in a long
date format, like : August 28, 1998


*/

function dateFormatS($date){
                $dy=substr($date,0,4);
                $dm=substr($date,4,2);
                $dd=substr($date,6,2);
                $condate=$dm."/".$dd."/".$dy;
                return $condate;                
}

function dateFormatL($date){
                $dy=substr($date,0,4);
                $dm=substr($date,4,2);
                $dd=substr($date,6,2);
                switch($dm){
                case "01":
                $dm="January";
                break;
                case "02":
                $dm="February";
                break;
                case "03":
                $dm="March";
                break;
                case "04":
                $dm="April";
                break;
                case "05":
                $dm="May";
                break;
                case "06":
                $dm="June";
                break;
                case "07":
                $dm="July";
                break;
                case "08":
                $dm="August";
                break;
                case "09":
                $dm="September";
                break;
                case "10":
                $dm="October";
                break;
                case "11":
                $dm="November";
                break;
                case "12":
                $dm="December";
                break;
                }
                $condate=$dm." ".$dd.", ".$dy;
                return $condate;                
}



Phorum, MySQL, Language, UK date format, MySQL UK Date format
Categories : PHP, Date Time, Strings, MySQL, Databases
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 wrapper function to format dates coming from a databases with the same syntax as PHP's date() function.
Categories : Date Time, Databases, PHP
Date Validation using JavaScript. Intended to use it as checkdate() from PHP.
Categories : Java Script, Date Time, PHP
string justification align center text
Categories : Strings, PHP, HTML and PHP
Text Wrapping
Categories : PHP, HTML and PHP, Strings
Function to create a separated list
Categories : PHP, Arrays, Strings
a class that uses microtime() to provide easy calculation of elapsed times
Categories : Date Time, PHP, PHP Classes
Simple function to return the number of days in a time span between 2 given dates.
Categories : PHP, Date Time, MySQL, Databases
Example of using the pcCalendar class, article 1468 on weberdev.com. Calendar example.
Categories : PHP, Date Time, PHP Classes, Calendar
Making sure a string containes only digits or no digits.
Categories : Strings, PHP, Regexps
How to control the number of decimal places when outputting numbers.
Categories : PHP, Strings, Variables
Bs_StopWatch is a class to measure time intervals in microseconds.
Categories : PHP, Date Time, PHP Classes
Calendars to choose a range of dates , reservation events ...
Categories : PHP, Calendar, Java Script, Date Time
Produces browser-safe strings while preserving HTML tags.
Categories : Strings, HTTP, PHP, HTML and PHP