Skip to content

Commit

Permalink
docs: minor fix
Browse files Browse the repository at this point in the history
Closes #304
  • Loading branch information
jmcnamara committed Aug 30, 2024
1 parent 7c2c929 commit 56f986e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/Excel/Writer/XLSX.pm
Original file line number Diff line number Diff line change
Expand Up @@ -3807,7 +3807,7 @@ Using format strings you can define very sophisticated formatting of numbers.
$worksheet->write( 8, 0, 36892.521, $format09 ); # 1 January 2001
$format10->set_num_format( 'dd/mm/yyyy hh:mm AM/PM' );
$worksheet->write( 9, 0, 36892.521, $format10 ); # 01/01/2001 12:30 AM
$worksheet->write( 9, 0, 36892.521, $format10 ); # 01/01/2001 12:30 PM
$format11->set_num_format( '0 "dollar and" .00 "cents"' );
$worksheet->write( 10, 0, 1.87, $format11 ); # 1 dollar and .87 cents
Expand Down Expand Up @@ -4400,7 +4400,7 @@ If you write a date string with C<write()> then all you will get is a string:
$worksheet->write( 'A1', '02/03/04' ); # !! Writes a string not a date. !!
Dates and times in Excel are represented by real numbers, for example "Jan 1 2001 12:30 AM" is represented by the number 36892.521.
Dates and times in Excel are represented by real numbers, for example "Jan 1 2001 12:30 PM" is represented by the number 36892.521.
The integer part of the number stores the number of days since the epoch and the fractional part stores the percentage of the day.
Expand Down
4 changes: 2 additions & 2 deletions lib/Excel/Writer/XLSX/Utility.pm
Original file line number Diff line number Diff line change
Expand Up @@ -1104,15 +1104,15 @@ This functions takes a cell reference string in A1 notation and decrements the c
=head1 TIME AND DATE FUNCTIONS
Dates and times in Excel are represented by real numbers, for example "Jan 1 2001 12:30 AM" is represented by the number 36892.521.
Dates and times in Excel are represented by real numbers, for example "Jan 1 2001 12:30:14 PM" is represented by the number 36892.521.
The integer part of the number stores the number of days since the epoch and the fractional part stores the percentage of the day in seconds.
A date or time in Excel is like any other number. To display the number as a date you must apply a number format to it: Refer to the C<set_num_format()> method in the Excel::Writer::XLSX documentation:
$date = xl_date_list( 2001, 1, 1, 12, 30 );
$format->set_num_format( 'mmm d yyyy hh:mm AM/PM' );
$worksheet->write( 'A1', $date, $format ); # Jan 1 2001 12:30 AM
$worksheet->write( 'A1', $date, $format ); # Jan 1 2001 12:30 PM
The date handling functions below are supplied for historical reasons. In the current version of the module it is easier to just use the C<write_date_time()> function to write dates or times. See the DATES AND TIME IN EXCEL section of the main L<Excel::Writer::XLSX> documentation for details.
Expand Down

0 comments on commit 56f986e

Please sign in to comment.