mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-10-04 02:48:26 +00:00
2a0a53cd6a
Because they tend to clutter our code a lot and unfortunately, there are lots of false positives. Instead, it would probably be better to deal with false positives out of band, via the Scrutinizer web UI.
28 lines
699 B
PHP
28 lines
699 B
PHP
<?php
|
|
|
|
use PhpOffice\PhpSpreadsheet\Spreadsheet;
|
|
|
|
require __DIR__ . '/../../Header.php';
|
|
|
|
$category = 'Date/Time';
|
|
$functionName = 'NOW';
|
|
$description = 'Returns the serial number of the current date and time';
|
|
|
|
$helper->titles($category, $functionName, $description);
|
|
|
|
// Create new PhpSpreadsheet object
|
|
$spreadsheet = new Spreadsheet();
|
|
$worksheet = $spreadsheet->getActiveSheet();
|
|
|
|
$worksheet->setCellValue('A1', '=NOW()');
|
|
$worksheet->getStyle('A1')
|
|
->getNumberFormat()
|
|
->setFormatCode('yyyy-mm-dd hh:mm:ss');
|
|
|
|
// Test the formulae
|
|
$helper->log(sprintf(
|
|
'Today is %f (%s)',
|
|
$worksheet->getCell('A1')->getCalculatedValue(),
|
|
$worksheet->getCell('A1')->getFormattedValue()
|
|
));
|