This routine works and formats the date exactly how I want it but I dont want current time. Instead I would like to format the time from a mysql database.
I have tryed this

strtotime($row_Recordset1['when']);

but it dont work.

How do i get my database field in the array and make this work, help me please someone befor I have no hair left. :cry:

$my_array =  localtime(time()) ; 
$wday = $my_array[6] ; 
$year = $my_array[5] +1900 ; 
//$yer = str[$year] ;
//$yr = substr($yer, 0, 2);
$month = $my_array[4] ;
$day = $my_array[3] ;
$date = $my_array[3] ;
$hour = $my_array[2] ;
$min = $my_array[1] ;

if ($hour >12) {
$hour = $hour-12 ;
$pm = "pm" ;
} else {
$pm = "am";
}
$alldays = array("sun","mon", "tue", "wed", "thur", "fri", "sat");
$allmonths = array("jan", "feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct", "nov", "dec") ; 
$datepost = array(" ", "st", "nd", "rd", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "th", "st", "nd","rd", "th", "th", "th", "th", "th", "th", "th","st") ;
<?php echo " $alldays[$wday] $day$datepost[$day] $allmonths[$month] $year at $hour:$min$pm"?>

it may help if you post the error msg ure getting ;)

commented: welcome to the forum, sarahk +1

I'd need to know what you are getting if you

echo $row_Recordset1['when'];
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.