Get timestamp from date('z') and year

date, php, strtotime, timestamp

Solution

Try the following:

`$timestamp = mktime(0,0,0,1,$day,$year);`

It will produce a timestamp where the time is set to 0:00:00. (I am not sure if it will behave correctly with respect to daylight savings though...)

Check the PHP manual for further details: PHP: mktime - Manual

Problem

I know the year and the day of year (0-365). Is there any way to get back from it to timestamp? Something like: ``` $day=date('z'); $year=2012; $timestamp=strtotime($day.'-nd day of '.$year); ```

Original source