0

i have this date : 28 september 2007.

I need this output : 007271

I'm using this code :

<?php 
  $julianDate = gregoriantojd(9, 28, 2007); 

  $dayfrac = date('G') / 24 - .5; 
  if ($dayfrac < 0) $dayfrac += 1; 

  $frac = $dayfrac + (date('i') + date('s') / 60) / 60 / 24; 

  $julianDate = $julianDate + $frac; 
  echo($julianDate); 
?>

My current output : 2454372.81824

I search on google and I found this website :

http://pgj.pagesperso-orange.fr/Calendrier_conversion.htm

When I try his tool with my date the output is :

"Jour Julien : 2454371.5" AND "Jour : 271 Année : 2007"

How can I complete this task? I don't know how to find the number of the day so I can concatenate it with the year so : AAA . JJJ

Thanks alot.

Peter
  • 1,719
  • 4
  • 22
  • 31

2 Answers2

0

the 28 septembre is the 271 days from the begin of the year 01 January ...

Peter
  • 1,719
  • 4
  • 22
  • 31
  • $dayNumber = date("z") + 1; $year = substr(date("Y"),1,4); $myanswer = $year.$dayNumber; – Peter Jun 26 '13 at 15:00
0

This may help you to identify

<?php 

$date = strtotime('28 september 2007');

$date1 = strtotime('01 january 2007');

//this may helps
echo round(($date - $date1)/(60*60*24));

?>
Sundar
  • 4,580
  • 6
  • 35
  • 61