#******************************************************************************
# function to date formate into one to another
#******************************************************************************
function convertDateFormat($datetorev,$currentformat="ymd",$outputformat="dmy",$seperateby="/")
{
//This function is is not completed. the work remaining is adding more format conversions
if (( $currentformat=="ymd") and ($outputformat=="dmy"))
{
list($year, $month, $day) = split('[/.-]', $datetorev);
return $day.$seperateby.$month.$seperateby.$year;
}
else if (( $currentformat=="ymd") and ($outputformat=="mdy"))
{
list( $year,$month,$day) = split('[/.-]', $datetorev);
return $month.$seperateby.$day.$seperateby.$year;
}
else if (( $currentformat=="dmy") and ($outputformat=="ymd"))
{
list( $day,$month,$year) = split('[/.-]', $datetorev);
return $year.$seperateby.$month.$seperateby.$day;
}
else if (( $currentformat=="dmy") and ($outputformat=="mdy"))
{
list( $day,$month,$year) = split('[/.-]', $datetorev);
return $month.$seperateby.$day.$seperateby.$year;
}
else if (( $currentformat=="mdy") and ($outputformat=="ymd"))
{
list( $month,$day,$year) = split('[/.-]', $datetorev);
return $year.$seperateby.$month.$seperateby.$day;
}
else if (( $currentformat=="mdy") and ($outputformat=="dmy"))
{
list( $month,$day,$year) = split('[/.-]', $datetorev);
return $day.$seperateby.$month.$seperateby.$year;
}
else
{
return "Not valid";
}
}
#******************************************************************************
[Wednesday, January 02, 2008
|
0
comments
]
Popular Posts
- php questions
- some php questions
- How to create a plugin in elgg.
- php Questions
- Mysql query for searching a value, add weightage on the number of occurances and sort based on the weight-age
- Contact Me
- solving the packaging problem in PHP
- How to add or remove WWW on URLs using htaccess.
- php questions
- Inserting nodes into xml files using XML DOM in PHP .
0 comments
Post a Comment
Please put your comments here. your questions, your suggestions, also what went wrong with me.