Benefits of PHP 5.2

Posted by Mattias Sandström on March 11, 2010

With version 1.4.40 of Tangix HelpDeskPRO we took the step of moving forward to require PHP 5.2 (or later) for operation. While no 5.2-specific functions were introduced in that version, the foundation to make use of PHP 5.2’s new functions was laid. In HelpDeskPRO version 1.4.45 a major improvement in PHP 5.2 was utilized to get better handling of timezone information using the date_timezone_set() function.

The timezone support functions are greatly improved in PHP 5.2 and handling of DST is now automatic. Previous versions of Tangix HelpDeskPRO included a home-made timezone-handling function that did not take differences in DST into account. Furthermore, for old dates, the DST was not taken into account making the dates off. Using the combination of the MySQL command UNIX_TIMESTAMP to calculate the UTC-time of date and time from the database (taking into the account the timezone of the server), date_timezone_set() function and PHP’s date() function is able to calculate the correct time in the selected timezone.

The staff preference page needed to be changed and modeled after the timezone settings in Windows:

timezones.png

The lack of timezone support was obvious when we took another advantage of PHP 5.2 - the ability to include the PHPExcel class to generate Excel-files from PHP. Using this class to generate Excel-files containing time and date information we noted that the dates were off in the Excel-file due to improper conversions between timezones.

--Mattias Sandström

 
 
 

Copyright © 2005-2012 Tangix Design & Development. All rights reserved