Best performance strategy for converting dates from MySQL format to Excel with PHP -
I'm still new to PHP, MySQL (and Zend Framework).
I have this function that I have marked the main execution killer of this particular script, I need to convert the stars into wires in the dated MM / DD / YYYY format. When the result set is small enough (40 or 50 lines), it lasts less than one second but when more records are recorded, then 4000 says this function takes about 4 minutes. is a very useful function of php which is called date_format which can be defined as < / P> The above string 'D-M-Y' can be inserted in different formats. Take a look at the Php site, which breaks down the available formats Public Functions ConvertAtexExcelformat () {$ sql = "fil_id, select BIRTH_DATE, WILL_DATE, What is the best strategy for such cases? LAST_CODICIL_DATE, Added from TRAST_DATE, POA_DATE "; $ Result = $ this- & gt; GetAdapter () - & gt; Get all ($ sql); Foreign currency ($ $ rowset = & gt; $ line) {foreach ($ line & amp; $ val) {if (strpos ($ val, ':')) {$ val = preg_replace ('/ [0-9] +: [0- 9] +: [0- 9] + / ',' ', $ val); $ Val = preg_replace ('/ - /', '/', $ val); $ Val = substr ($ val, -6, 5). '/' Substr ($ val, 0, 4); $} ['LAST_CODICIL_DATE'], & quot; $ Line ['LAST_CODICIL_DATE'], & quot; $ Line = TRUST_DATE '= & gt; $ Line ['TRUST_DATE'], 'POA_DATE' = & gt; $ Line ['POA_DATE'],); $ Where = $ this- & gt; GetAdapter () - & gt; In quote ('fil_id =?', $ Line ['fil_id']); $ This- & gt; Update ($ data, $ where); } $ This return; }
$ newDateVar = date_format ('dm-y', $ inputDateVar);
Comments
Post a Comment