DateMath |
[eluser]Nabeel[/eluser]
Hey everyone! My first post and contribution I wrote my own little "toolkit" which has been working great for me (never looking at CI before, but the way I did modules, etc, URL rewriting is almost close to CI, instead of regular expressions, I map array elements to URL segments, but I digress), but learning CI now for work, and decided to port a few of the classes I wrote over to libraries, since I end up using them, and it's useful. I haven't searched to see if it's available already, if it is, well, that's ok This one does basic math on dates - you can pass it date/time (in the MySQL format, timestamp, plain text), and it can do: Code: $this->datemath->add_time($time1, $time2) It's useful in doing things like "You posted 2 weeks ago". You can check it out here: http://api.phpvms.net/index.php/datetest For example, "Start" enter January 31st, and "End" enter "Today". I entered "Yesterday" and "Today": Quote:There are 1 months in range: Mar 2009 add_time() will add two times together (ie, 1:50 + 1:50 = 3:40, not 3:00) And you can download it from here: http://nsslive.net/downloads/ci_datemath.zip It includes the above "datetest" controller, which shows how to use it. I guess I need to write an article in the wiki on use. Let me know of any bugs; I've been using it on a few projects and seemed to have fixed most of the kinks. I have a charting library as well, based on pChart, which falls back on GoogleCharts if GD isn't found, would anyone be interested in that? |
Messages In This Thread |
DateMath - by El Forum - 03-23-2009, 09:30 AM
DateMath - by El Forum - 03-23-2009, 03:03 PM
DateMath - by El Forum - 03-23-2009, 03:58 PM
DateMath - by El Forum - 03-24-2009, 05:48 AM
DateMath - by El Forum - 03-24-2009, 07:42 AM
DateMath - by El Forum - 03-24-2009, 07:49 AM
DateMath - by El Forum - 03-24-2009, 07:50 AM
DateMath - by El Forum - 03-24-2009, 07:52 AM
DateMath - by El Forum - 03-24-2009, 07:54 AM
|