Posted by : Safras Ahamed Friday, March 22, 2013

This is a set of small functions I use, this will make my life easy, no need to remember all the variables at date() function and you can make some predefined functions that you use always.













saf.date.functions.php
<?php
//Pass 2007-01-22 as date and output  as January 22, 2007
function SafDate1V2($date){
    list($y,$m,$d) = explode("-",$date);
    $mycooldate = date("F d, Y",mktime(0, 0, 0, $m, $d, $y));
    return $mycooldate;
}
//Pass 2007-01-22 as date and output  as Jan 22, 2007
function SafDate2V2($date){
    list($y,$m,$d) = explode("-",$date);
    $mycooldate = date("M d, Y",mktime(0, 0, 0, $m, $d, $y));
    return $mycooldate;

}
//Pass 2007-01-22 as date and output  as Jan 22, 07
function SafDate3V2($date){
    list($y,$m,$d) = explode("-",$date);
    $mycooldate = date("M d, y",mktime(0, 0, 0, $m, $d, $y));
    return $mycooldate;
}
//Pass 2007-01-22 as date and output as Sunday Jan 22, 2007
function SafDate4V2($date){
    list($y,$m,$d) = explode("-",$date);
    $mycooldate = date("l M d, Y",mktime(0, 0, 0, $m, $d, $y));
    return $mycooldate;
}
?>
<?php
//Pass 2007-01-22 as date and output as Sun, Jan 22, 2007
function SafDate5V2($date){
    list($y,$m,$d) = explode("-",$date);
    $mycooldate = @date("D, M d, Y",mktime(0, 0, 0, $m, $d, $y));
    return $mycooldate;
}
?>

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Popular Post

Blogger templates

Labels

- Copyright © My Code Genius by 2 Geniuses -Metrominimalist- Powered by Blogger - Designed by Johanes Djogan -