PHP Classes

This is a completely superfluous class - why use this when yo...

Recommend this page to a friend!

      Dates Utils  >  All threads  >  This is a completely superfluous...  >  (Un) Subscribe thread alerts  
Subject:This is a completely superfluous...
Summary:Package rating comment
Messages:8
Author:rjan Langbakk
Date:2014-06-14 15:38:04
Update:2014-06-15 15:37:11
 

rjan Langbakk rated this package as follows:

Utility: Bad
Consistency: Sufficient

  1. This is a completely superfluous...   Reply   Report abuse  
Picture of rjan Langbakk rjan Langbakk - 2014-06-14 15:38:04
This is a completely superfluous class - why use this when you can simply use PHP 5s built-in DateTime-class?
It does what this class claims to do, and more, and no need to implement another class.

  2. Re: This is a completely superfluous...   Reply   Report abuse  
Picture of Daniel Andres Marjos Daniel Andres Marjos - 2014-06-14 16:10:33 - In reply to message 1 from rjan Langbakk
Ok... You seem to forget a few things: First, many PHP built in date/time functions depend on properly set timezone and or locale. Second, not everybody uses PHP5 or greater. More, not every date/time string possible in every language in every country in the world is compatible to be used with strtotime function. This class allows to easily convert from one string date/time format to another, without having to deal with timezone and locale settings.

You may think it's irrelevant or superfluous. But not always, every built in feature is available. You should be a little more open mind.

  3. Re: This is a completely superfluous...   Reply   Report abuse  
Picture of rjan Langbakk rjan Langbakk - 2014-06-14 18:25:05 - In reply to message 2 from Daniel Andres Marjos
What the h*ll does strtotime have to do with anything?

I suggest looking into DateTime - it operates independent of server settings (timezones etc.), and also, if you want to make sure, you just configure your server, or at least the PHP-scripts to use a specific timezone - or for that matter, if you want user-based timestamps, set it to use the user's timezone - aka "how to wreak havoc in message boards".

I do realise that not everyone uses PHP 5 - but if they don't, it's basically their loss, and they need to get with the program. PHP 5.2.0 has been out for 8 years. _EIGHT_. If you're not using something at least this "new", you're begging for a load of problems.

The point I'm making is that it's perfectly possible to use DateTime() to do what you're doing with this class, regardless of whatever timezone or locale you have set in PHP or on the server.

As far as I can see, the class you're providing takes an input, and outputs it formatted differently (using the same date, of course).
This can be very easily done in DateTime as well.
Example:

$newDT = new DateTime('2014/06/24'); //creates a DateTime-object
echo $newDT->format('m - d - Y') //reformats the DateTime-object

  4. Re: This is a completely superfluous...   Reply   Report abuse  
Picture of Daniel Andres Marjos Daniel Andres Marjos - 2014-06-15 01:34:42 - In reply to message 3 from rjan Langbakk
Ok... So, please, provide an alternative to every single class in the PHPClasses repository that is "superfluous" and give me a break. You are most seemingly forgetting the most important reason of PHPClasses.org: To teach others about the PHP language. Don't you see that the solution I'm presenting with this class is not limited or restricted to date/time format conversion? That blind are you?

  5. Re: This is a completely superfluous...   Reply   Report abuse  
Picture of Daniel Andres Marjos Daniel Andres Marjos - 2014-06-15 01:36:40 - In reply to message 3 from rjan Langbakk
And again... Did you read the part where I said "not every single hosting company in the world provide PHP 5"?

Look buddy... I know what frustration is. Just give me a break...

  6. Re: This is a completely superfluous...   Reply   Report abuse  
Picture of Daniel Andres Marjos Daniel Andres Marjos - 2014-06-15 01:39:04 - In reply to message 3 from rjan Langbakk
And by the way... If you know that much about PHP... where are your contributions to the repository? Is so easy to complain about other's work...And yours? Where and how can we see your work or your contributions to others?

freak off

  7. Re: This is a completely superfluous...   Reply   Report abuse  
Picture of rjan Langbakk rjan Langbakk - 2014-06-15 12:33:34 - In reply to message 4 from Daniel Andres Marjos
If by "not restricted" you're referring to the ability to fail if one forgets to set the correct format of the provided string, for instance, sure.

If you're thinking about modifying the class to abide with other conversions, also sure.

If you're talking about providing ability to take any string and convert it arbitrarily, also sure, but why the h*ll would you use something that isn't a normal formatted date/time to represent datetime?

And why call a class that is not "restricted to date/time format conversion" DatesUtils? Sorry - you might be mad at me, but that doesn't change the fact that this is a superflous class, and you would be better off writing a better DateTime-parser, if you want to provide more functionality.

  8. Re: This is a completely superfluous...   Reply   Report abuse  
Picture of Daniel Andres Marjos Daniel Andres Marjos - 2014-06-15 15:37:11 - In reply to message 7 from rjan Langbakk
Ok... Again... what contributions did you submit to the repository? Oh... just a dumb question... Perhaps when you start to make some kind of contribution we all could see if your classes are "superfluous" or "useless". In the meantime, please, just shut up

 
For more information send a message to info at phpclasses dot org.