The Mercurian Empire http://hermertia.com/ |
|
New and improved calendar http://hermertia.com/viewtopic.php?f=14&t=1008 |
Page 4 of 4 |
Author: | Aren [ February 12th, 2017, 8:49 am ] |
Post subject: | Re: New and improved calendar |
The php posted here gives me 552 for this year. The date at top of forum says 545. And it's 546. something doesn't match up. On the other hand, this bit of php seems to be accurate Code: <?php
$this_day = date('d'); //today $this_month = date('m'); $this_year = date('Y'); $base_month = '7'; $base_year = '2009'; $month_diff = (($this_year - $base_year) * 12) + ($this_month - $base_month); $canonyears_diff = $month_diff * 6; $mod = array(-2,-1,0,1,2,3,3); $year_mod = $mod[($this_day - 1) / 5]; // magic $current_year = $canonyears_diff + $year_mod; ?> |
Author: | Johanssen [ February 12th, 2017, 5:47 pm ] |
Post subject: | Re: New and improved calendar |
Aren wrote: The php posted here gives me 552 for this year. The date at top of forum says 545. And it's 546. something doesn't match up. On the other hand, this bit of php seems to be accurate Code: <?php $this_day = date('d'); //today $this_month = date('m'); $this_year = date('Y'); $base_month = '7'; $base_year = '2009'; $month_diff = (($this_year - $base_year) * 12) + ($this_month - $base_month); $canonyears_diff = $month_diff * 6; $mod = array(-2,-1,0,1,2,3,3); $year_mod = $mod[($this_day - 1) / 5]; // magic $current_year = $canonyears_diff + $year_mod; ?> Hhhmmmmm... I may have posted an old version of the code for the one. Let me check, I'll also try your version on my test site. |
Page 4 of 4 | All times are UTC [ DST ] |
Powered by phpBB® Forum Software © phpBB Group https://www.phpbb.com/ |