Goofing up date and time calculations.

May 2, 2006

No matter how many programming languages I learn (I know quite a few), one thing I will never master is date and time calculations. In times past, I have even called my self the april fool of programming. Name calling isn't the solution to the problem. There isn't a solution!

I realised just how bad I am at date and time calculations when testing Log Mine, Log Mine very embarrasingly shows 31 days for the month of February. I have used a very tedious calculation to derive the number of days in a month. Turns out all I need to do is to call the date function with the time stamp and the parameter 't'.

$days = date('t',$summary->currentDate[0]);
Hopefully I will remember this the next time I have to deal with dates and times.

Posted by raditha at May 2, 2006 10:03 AM
Your Ad Here

 

Jabber  |  Linux  |  mySQL  |  PHP  |  Java  |  Site Map  |  Wiki

Downloads  |  About  |  Links  |  Contact  |  Home

 

Copyright © Raditha Dissanayake 2003 - 2007

Terms of Use  |  Privacy

 

 

May 2006
Sun Mon Tue Wed Thu Fri Sat
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31