Hi Alan

I found the easiest way to work with dates to keep from having to do this all the time is to start with unix date time, do calculations on it, and then convert it back to whatever format you want.

For example, today is 1208129349, which is that many seconds past the Unix epoch start time, which is January 1, 1970. (http://en.wikipedia.org/wiki/Unix_time)

If I want 283 days in the future I add 1208129349 + (283 days *24 hours*60 minutes*60second) = 1232580549 and I convert that to whatever date format I want.

It saves the hassle of having to count months and end of years and all that.

Luck

----- Original Message ----- From: "Alan Neilsen" <[EMAIL PROTECTED]>
To: <flashcoders@chattyfig.figleaf.com>
Sent: Sunday, April 13, 2008 5:10 PM
Subject: [Flashcoders] Adding n days to dateField.selectedDate


I am building a cattle birthing calculator. Can anyone help me with the code to add a certain number of days (usually around 283) to the output of a dateField.selectedDate (breeding date) so the result can be put into a string and output to a text field such as, "The estimated birthing date is 7/7/2008." Currently my output can show spurious dates like the 13/33/2008, and I assume there is an easy way of adding days and ending up with a real date.

_______________________________________________
Flashcoders mailing list
Flashcoders@chattyfig.figleaf.com
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Reply via email to