Page 1 of 1

Date'ish conversion

Posted: Sun Oct 22, 2006 6:24 am
by Shendemiar
Is there an easy way to transform date of "Y:z"-format (Today would be (2006:294) to a normal date?

Posted: Sun Oct 22, 2006 6:27 am
by ddragas

Posted: Sun Oct 22, 2006 6:41 am
by Shendemiar
Wasnt so complicated, but for some reason you need to add one day.

Code: Select all

# From format "Yz"

function tdate($time){
  $y = substr($time,0,4);
  $d = substr($time,4,3);

  return date("Y-m-d", mktime(0,0,0,1,$d+1,$y));
}