UBB.Dev
Posted By: chillin Get Date from Day of Year - 11/18/2003 3:47 AM
I'm attempting to manipulate a flat text file (csv) that stores day/time info in the following format:

YEAR, TIME(24), DAY OF YEAR
eg:
2003, 1500, 310

Which functions would I use to format this into a timestamp:
MM/DD/YYYY HH:MM:SS?

Thank you in advance for any help!
Posted By: Gardener Re: Get Date from Day of Year - 11/18/2003 5:04 AM
<?php
$datestr = "2003, 1500, 310";
$datearr = explode(", ", $datestr);
$h = substr($datearr[1], 0, 2);
$m = substr($datearr[1], 2);

echo date ("m/d/Y H:i:s", mktime ($h,$m,0,1,$datearr[2],$datearr[0])) . "\n";
?>
Posted By: chillin Re: Get Date from Day of Year - 11/18/2003 5:32 AM
many thanks, thats perfect!
Posted By: Gardener Re: Get Date from Day of Year - 11/18/2003 5:33 AM
You're welcome!
© UBB.Developers