date - PHP How to reverse engineer the day of the year 3212 (YDDD) into 2013-08-01 (YYYY-mm-dd) -


i have date in yddd format such 3212
i want convert date default date string i.e. 2013-08-01 in php
since first value y character year, i've decided take first 3 characters current year i.e. 201 2013
following code i've written year

<?php $date = "3212" $y = substr($date,0,1); // take out 3 out of year 3212 $ddd = substr($date,1,3); // take out 212 out of year 3212 $year = substr(date("y"),0,3) . $y; //well create year "2013" ?> 

now how can use $year , 212 convert 2013-08-01 using php

edit
fyi: php version 5.3.6

$date = "3212"; echo datetime::createfromformat("yz", "201$date")->format("y-m-d"); // 2013-08-01 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -