MaggsWeb:7

www.maggsweb.com

Posts Tagged ‘ date ’

PHP date dashes to slashes

October 31, 2011 | Comments | PHP

Converting a date format, simply and quickly.

<?php
 
   function reverseDate($dateIn){
       list($year,$month,$day) = explode('-',$dateIn);
       return "$month/$day/$year";
   }
 
?>

This function is used on my own site : http://www.maggsweb.co.uk

Easy way of switching between mysql and “normal” dates (english, not american)…

<?php
function flipdate($dt, $seperator_in = '-', $seperator_out = '-')
{
return implode($seperator_out, array_reverse(explode($seperator_in, $dt)));
}
?>

Just a little script I wrote to work out the date of the first day of the week.
[More]