So, I’m trying to make a calendar webapp, currently only for personal use, since it’s in development. I’ve designed the calendar table without any problems. HTML and CSS is no problem.

I also have a tool on that site to convert from Gregorian to Cotsworth, which I grabbed from somewhere else.

However, I want the site to display today’s date automatically, and I’ve laid the ground work for that in PHP. I defined a variable which counts the days since January 1st, and have a lengthy ifelse list to get current month from the $dayofyear variable I defined, but to go further and actually get the date in IFC format is the thing I’ve not been able to. Any help on that would be greatly appreciated!

Here’s the code:

$now = time(); // or your date as well

$your_date = strtotime("2020-01-01"); //yyyy-

$dayofyear = $now - $your_date;

$day = round($dayofyear / (60 * 60 * 24));

$date = round($dayofyear / (7));

$year = date("Y");

if ($day > 0 && $day < 27) {

`echo 'Januar ', $year;`

}

elseif ($day > 28 && $day < 55) {

`echo 'Februar ', $year;`

}

elseif ($day > 56 && $day < 83) {

`echo 'Mars ', $year;`

}

elseif ($day > 84 && $day < 111) {

`echo 'April ', $year;`

}

elseif ($day > 112 && $day < 139) {

`echo 'Mai ', $year;`

}

elseif ($day > 140 && $day < 168) {

`echo 'Juni ', $year;`

}

elseif ($day > 169 && $day < 196) {

`echo 'Sol ', $year;`

}

elseif ($day > 197 && $day < 224) {

`echo 'Juli ', $year;`

}

elseif ($day > 225 && $day < 252) {

`echo 'August ', $year;`

}

elseif ($day > 253 && $day < 280) {

`echo 'September ', $year;`

}

elseif ($day > 281 && $day < 308) {

`echo 'Oktober ', $year;`

}

elseif ($day > 309 && $day < 336) {

`echo 'November ', $year;`

}

elseif ($day > 337 && $day < 365) {

`echo 'Desember ', $year;`

}

else {

`echo '<i>Feil i kildekode...</i></p>';`

}

If you’re unfamiliar with the Cotsworth Calendar (IFC), it’s divided the year into thirteen months with 28 days each, plus an extra day in December to add up to 365 total. Leap day is placed at the end of june. Those two extra days are not assigned to any weekday, but stands as their own separate days.

Post image

Heres what December looks like, with the holidays marked out. Nyttårsaften is New Years Eve, or Year Day as Cotsworth himself renamed it. (It also happens to be my birthday)



Source link

Write A Comment