Find the moon phase for any date.
Moon phase is a function of the moon's age within the synodic month of 29.53 days. Converting the calendar date to a Julian day number and measuring the elapsed time since a known new moon gives that age directly, and the illuminated fraction follows from a cosine of the phase angle. Which limb appears lit reverses between hemispheres, which is why the hemisphere selection changes the description rather than the numbers.
Moon age and illumination
Moon age = (Julian day - 2451550.09766) mod 29.530588853; illumination = (1 - cos(2 pi x age / 29.53)) / 2 x 100
The synodic month averages 29.53 days from one new moon to the next, though individual cycles vary by several hours because the moon's orbit is elliptical.
Southern hemisphere observers see the moon rotated roughly 180 degrees, so a waxing crescent appears lit on the left rather than the right.
The mean synodic approximation is typically within a few hours of the true phase, which is ample for planning observation, photography or night-time activity.