Page 1 of 1
date mathematical operation
Posted: Tue Aug 10, 2004 10:19 pm
by g3ckO
I stored the date in MySQL using date format (yyyy-mm-dd)
How can I do a mathematical operation on it.
As an example, I want to count the total day from $dateStart = (2004-08-22) to $dateEnd = (2004-08-27).
How should I write it?
Posted: Tue Aug 10, 2004 10:25 pm
by hawleyjr
Google "MySql compare dates" or check out
mysql.com or search this forum there have been many topics regarding this.
Posted: Tue Aug 10, 2004 10:42 pm
by g3ckO
any more specific solution??

Posted: Tue Aug 10, 2004 10:52 pm
by feyd
if you want to do the math yourself, UNIX_TIMESTAMP() <- mysql function
Posted: Tue Aug 10, 2004 10:57 pm
by g3ckO
I have read many article about UNIX_TIMESTAMP() but its quite hard for me to understand it.
But my friend have give me better solution I think. He told me why not just ask the user to key in the total day in the form.
What your opinion??
Posted: Tue Aug 10, 2004 11:00 pm
by hawleyjr
The least amount of work you make your users do the better. Make the computer do all the cruddy stuff (math)
Posted: Tue Aug 10, 2004 11:04 pm
by g3ckO
Yeah.. but I'am not good enough to ask the computer to do it for me... and the clock is ticking...
