tags:

views:

45

answers:

3

eg.

let say it is the 326 day of the year.

you want to be able to get the month and the day of the month eg. Oct 23 etc.

what is the formula. how do i achieve this in php.

A: 

take a look at the php date manual. http://php.net/manual/en/function.date.php

<?php
echo date('d-m'); //echoes 16-08
?>
Tim
+1  A: 
date('m Y', strtotime($year . '-01-01 +' . ($day_of_year - 1) . 'days');

will get you a string containing the month and the year.

jezmck
A: 
$d = date('m Y', strtotime($year . '-01-01'));
$d->add(new DateInterval('P' . $day_of_year . 'D'));
echo $d->month . ' ' . $d->mday; // same as `echo $date->format('F j')`, or "October 23"

See PHP DateTime::add reference

palswim