Hi

Please any help me on the below issue

i am having a interger as below the formate is CYYDDD

114024

i want to change the above line as

24-01-2014

Recommended Answers

All 5 Replies

use below

<?php 
$a=114024;
echo date('d-m-Y',strtotime($a));

?>

Is this your solution:

<?php 
function jde_date_conv($jde_date) 
{ 

$ct = substr($jde_date,0,1); 
$yr = substr($jde_date,1,2); 
$dy = substr($jde_date,3,3); 

if($ct == 0) $yr_pfx = 19; 
if($ct == 1) $yr_pfx = 20; 

$tlt_yr = $yr_pfx.$yr; 

$base_time = mktime(0,0,0,1,0,$tlt_yr); 

$unix_time = ($dy * 86400) + $base_time; 

return date("d-m-Y" , $unix_time); 
} 
?>

Edit: you have shorter solution above.

Or even this one which is also abandoned?

Hi Tpojka

Thanks for your help

its working fine

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.