Hi guys, I am pretty new to php and javascript in general, but more so to php since i have some small background in java programming.
I am trying to convert this code into php since I need variables which i can only get in php and is proving to difficult to use otherwise except my code be in php as well. The problem is I’m not sure on exactly how to use variables and what classes(?) are available in php, or what time the date function works in for php.
[code][/code]
I tried this, but its probably pretty obvious to someone who knows what they are doing what things I’m doing wrong here. Please help, and thanks =]. Also this is supposed to be a basic converter to change a UNIX time stamp into something readable.
[php]<?php
function timeConverter($UNIX_timestamp)
{
$a = new Date(UNIX_timestamp*1000);
$months = array ( 'Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec' );
$year = $a.$getFullYear();
$month = $months($a.$getMonth());
$date = $a.$getDate();
$hour = $a.$getHours();
$min = $a.$getMinutes();
$sec = $a.$getSeconds();
$half = 'AM';
if($hour < 12)
{
}
else
{
$hour = $hour - 12;
$half = 'PM';
}
$time = $date+' '+$month+' '+$year+' '+$hour+':'+$min+':'+$sec+' '+$half;
return time;
}
?>[/php]