moon phasing

My heads hurting now, Cant work the maths out.

So far i have

The last new moon on the 15/1/2010 at 7:10 which is unix time 1263539400

the last full moon on the 30/1/2010 at 6:18 which is unix time 1264832280

A full cycle is 2551442.803 seconds

A half cycle is 1275721.4015

So what i need to do is increase a value from 0-max over half a cycle then from max-0 for the other half of the cycle.

I just cant think of a way to do this ?