perl - Convert YYDDD to YY/MM/DD -


i'm looking way convert date in format yyddd yy/mm/dd.

i.e. 12212 becomes 12/07/30.

an example in php can found @ http://www.longpelaexpertise.com.au/toolsjulian.php , can find ddd calendar @ http://landweb.nascom.nasa.gov/browse/calendar.html

i'd appreciate guidance both , without perl modules.

thanks!

edit: i'm not looking way convert php2perl or that. i'm looking way convert yyddd yy/mm/dd using perl. prefer way without using additional perl modules if way it, i'll welcome examples using perl modules.

here's short , sweet way want:

#!/usr/bin/perl  use strict; use date::calc qw(add_delta_days);  $dt = '12212';  $startyr = 2000 + substr($dt, 0, 2); $daystoadd = substr($dt, 2) - 1; ($newyr, $newmo, $newday) = add_delta_days($startyr, 1, 1, $daystoadd);  printf("%02d/%02d/%02d\n", $newyr % 100, $newmo, $newday); 

Comments

Popular posts from this blog

Unable to remove the www from url on https using .htaccess -