mirror of
https://github.com/PHPOffice/PhpSpreadsheet.git
synced 2026-08-18 19:10:37 +00:00
5266086781
Further reorganization following on PR #3890.
30 lines
703 B
PHP
30 lines
703 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(
|
|
'Today is '
|
|
. $worksheet->getCell('A1')->getCalculatedValue()
|
|
. ' ('
|
|
. $worksheet->getCell('A1')->getFormattedValue()
|
|
. ')'
|
|
);
|