"phpexcel date required dd/mm/yy" Answer’s

0

You're not constrained by the predefined constants; those are just some of the format strings that MS Excel recognises... a comprehensive list of ever possible mask would be excessive.... and unnecessary... all you're doing is passing a string value to the setFormatCode() method, so you can pass a string literal.

The MS Excel mask for the format that you want is dd-mmm-yyyy, and you can set that simply as a string literal rather than using any constant:

$objPHPExcel->getActiveSheet()
    ->getStyle('V'.$i)
    ->getNumberFormat()
    ->setFormatCode('dd-mmm-yyyy');

Note that MS Excel itself has a "custom" option for number format codes, which allows you to set a string literal in exactly the same way

Saturday, May 29, 2021
 
Teno
answered 9 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :