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?
[eluser]quasiperfect[/eluser]
thanks will test it out i'm interested in the charts lib, please post it
[eluser]Nabeel[/eluser]
Cool! I'm working on converting it to the CI format, gotta see where to put the pChart stuff
[eluser]Nabeel[/eluser]
[quote author="jdfwarrior" date="1237913335"]camel case blah.[/quote] What's wrong with camel case?
[eluser]jdfwarrior[/eluser]
[quote author="Nabeel" date="1237920131"][quote author="jdfwarrior" date="1237913335"]camel case blah.[/quote] What's wrong with camel case?[/quote] Actually nothing, more personal preference than anything. That and I just try to follow the style guide to keep everything uniform. Style guide doesn't recommend it. Pulled from the style guide.. Examples of improper and proper method naming: Code: INCORRECT:
[eluser]Nabeel[/eluser]
Gotcha, I can change those. I've been using CC for years, just habit
[eluser]jdfwarrior[/eluser]
Aint got to change them on my account. Like I said for me its personal preference and just conformity. Can do whatever you like.
[eluser]Nabeel[/eluser]
Well, I'd rather stay within the style guide, I haven't noticed that before |
Welcome Guest, Not a member yet? Register Sign In |