This section of the archives stores flipcode's complete Developer Toolbox collection, featuring a variety of mini-articles and source code contributions from our readers.

| Moon Phase Calculator Submitted by

Here's a small submission for the COTD feature which somebody might find useful, it calculates the age of the moon from new in days. and people can use it for whatever they want.

Download Associated File: moonage.txt (322 bytes)

    // COTD Entry submitted by Arclight [Daniel.Davies@blueyonder.co.uk]

    Function Moon_Age(y,m,d : integer) : integer; stdcall;
    var i : integer;
        c : integer;
    begin
         c:=(y div 100);
         if (m>2) then dec(m,2) else inc(m,10);
         i:=((((((y mod 19)*11)+(c div 3)+(c div 4)+8)-c)+m+d) mod 30);
         moon_age:=i;
    end;

The zip file viewer built into the Developer Toolbox made use of the zlib library, as well as the zlibdll source additions.

Copyright 1999-2008 (C) FLIPCODE.COM and/or the original content author(s). All rights reserved.
Please read our Terms, Conditions, and Privacy information.