|
|
|
/*
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 | | | Calendar using Date function Categories : HTML and PHP, PHP, Date Time, Calendar | | | Avoiding or Detecting high bit characters in a string. Useful when you want to create a valid RSS feed Categories : PHP, Strings, Unicode, Regexps, Rich Site Summary (RSS) | | | Select with current month Categories : PHP, HTML and PHP, Date Time, Arrays | | | checkdate -- Validate a gregorian date/time Categories : PHP, PHP Functions, Date Time | | | explode() and SQL blobs Categories : General SQL, Strings, PHP, Databases | | | Using data from a string. Categories : PHP, Strings, CURL | | | function textwrap will wrap text to any desired width using <BR>\n as the default line break.
Default wrap width is 80 columns.
Categories : Strings, HTML and PHP, PHP | | | a class that uses microtime() to provide easy calculation of elapsed times
Categories : Date Time, PHP, PHP Classes | | | Date Validation using JavaScript. Intended to use it as checkdate() from PHP. Categories : Java Script, Date Time, PHP | | | I need a trim function/regexp that will trim all " " from the ends of a string. Categories : Regexps, PHP, Strings | | | A Timing Class Categories : PHP, PHP Classes, Date Time | | | mysql_escape_string Categories : PHP, MySQL, Databases, Strings | | | Allows you to parse a deliniated string and put the individual fields in a SELECT option in a form Categories : HTML, PHP, Strings | | | Finding the day of the week for a specific date.
Categories : PHP, Databases, MySQL, Date Time | |
|
|
|