---
title: "Räkna ut månfaser"
type: "forum-thread"
url: "https://www.webforum.nu/amne/webbutveckling/177916-räkna-ut-månfaser"
topic: "Webbutveckling"
topic_url: "https://www.webforum.nu/amne/webbutveckling"
author: "Oddish"
published: "2009-04-07T14:31:18.000Z"
updated: "2009-04-07T14:31:18.000Z"
replies: 0
views: 1148
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/webbutveckling/177916-räkna-ut-månfaser"
---

# Räkna ut månfaser

## #1 — Oddish, 2009-04-07T14:31Z

Jag försöker hitta kod för att räkna ut månfaser (exempel: <http://www.dinstartsida.se/kalender-manfaser.asp>) och hittade en PHP-funktion för detta ändamål här: <http://jivebay.com/2008/09/07/calculating-the-moon-phase/>

Problemet är att den ger följande resultat för april:

> 1 april Quarter Moon (2)
> 2 april Quarter Moon (2)
> 3 april Quarter Moon (2)
> 4 april Waxing Gibbous Moon (3)
> 5 april Waxing Gibbous Moon (3)
> 6 april Waxing Gibbous Moon (3)
> 7 april Waxing Gibbous Moon (3)
> 8 april Full Moon (4)
> 9 april Full Moon (4)
> 10 april Full Moon (4)
> 11 april Full Moon (4)
> 12 april Waning Gibbous Moon (5)
> 13 april Waning Gibbous Moon (5)
> 14 april Waning Gibbous Moon (5)
> 15 april Last Quarter Moon (6)
> 16 april Last Quarter Moon (6)
> 17 april Last Quarter Moon (6)
> 18 april Last Quarter Moon (6)
> 19 april Waning Crescent Moon (7)
> 20 april Waning Crescent Moon (7)
> 21 april Waning Crescent Moon (7)
> 22 april Waning Crescent Moon (7)
> 23 april New Moon (0)
> 24 april New Moon (0)
> 25 april New Moon (0)
> 26 april New Moon (0)
> 27 april Waxing Crescent Moon (1)
> 28 april Waxing Crescent Moon (1)
> 29 april Waxing Crescent Moon (1)
> 30 april Quarter Moon (2)

Både dinstartsida.se och kalender.se verkar överens om att nästa fullmåne är på torsdag den 9 april och det stämmer ju enligt funktionen också. Men enligt denna är det fullmåne 8-11 april och det kan ju inte stämma?

Om någon sitter inne på en bra funktion (inte nödvändigtvis i php) för att räkna ut månfaser enligt exemplen på dinstartsida.se och kalender.se, eller kanske ett tips om hur jag kan förbättra funktionen ovan vore jag enormt tacksam.

Permalänk: https://www.webforum.nu/p/177916

---

Tråden på webben: https://www.webforum.nu/amne/webbutveckling/177916-räkna-ut-månfaser
