Date'ish conversion

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Shendemiar
Forum Contributor
Posts: 404
Joined: Thu Jan 08, 2004 8:28 am

Date'ish conversion

Post by Shendemiar »

Is there an easy way to transform date of "Y:z"-format (Today would be (2006:294) to a normal date?
User avatar
ddragas
Forum Contributor
Posts: 445
Joined: Sun Apr 18, 2004 4:01 pm

Post by ddragas »

Shendemiar
Forum Contributor
Posts: 404
Joined: Thu Jan 08, 2004 8:28 am

Post 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));
}
Post Reply