Topics
All
MacOS
(Only)
Windows
(Only)
Linux
(Only, Not)
iOS
(Only, Not)
Components
Crossplatform Mac & Win
Server
Client
Old
Deprecated
Guides
Examples
Videos
New in version:
9.5
10.0
10.1
10.2
10.3
10.4
10.5
11.0
11.1
11.2
Statistic
FMM
Blog
Packs date and time information into double type.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
XL | 3.5 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
Parameter | Description | Example | Flags |
---|---|---|---|
bookRef | The reference to the workbook. Please use XL.LoadBook to load a file. | $ref | |
year | The year value. | 2013 | |
month | The month value from 1 to 12. | 10 | |
day | The day value. | 18 | |
hour | The hour value from 0 to 23. | 11 | Optional |
minute | The minute value from 0 to 59. | 1 | Optional |
second | The second value from 0 to 59. | 5 | Optional |
msec | The millisecond value from 0 to 999. | 0 | Optional |
Returns timestamp number or error.
Build a date:
MBS( "XL.Date.Pack"; $$book; 2013; 10; 21; 19; 55; 13)
// shows 41568.83001157407125
Build a date without time:
MBS( "XL.Date.Pack"; $$book; 2013; 10; 21)
Create Excel file with some date value:
#create new xls file
Set Variable [$book; Value:MBS( "XL.NewBook"; 0 )]
#create date format
Set Variable [$dateFormat; Value:MBS( "XL.Book.AddFormat"; $book)]
Set Variable [$dateFormatID; Value:MBS( "XL.Book.AddCustomNumFormat"; $book; "mmmm\ d\,\ yyyy")]
Set Variable [$r; Value:MBS( "XL.Format.SetNumFormat"; $book; $dateFormat; $dateFormatID)]
#create sheet
Set Variable [$sheet; Value:MBS( "XL.Book.AddSheet"; $book; "Sales Receipt")]
#Write date
Set Variable [$d; Value:MBS( "XL.Date.Pack"; $book; 2013; 10; 21)]
Set Variable [$r; Value:MBS( "XL.Sheet.CellWriteNumber"; $book; $sheet; 4; 4; $d; $dateFormat)]
#
Set Field [Writing data::Output; MBS("XL.Book.Save"; $book; "test.xls")]
Set Variable [$r; Value:MBS("XL.Book.Release"; $book)]
Created 18th August 2014, last changed 9th July 2015
XL.Date.DoubleToTimeStamp - XL.Date.TimeStampToDouble
Feedback: Report problem or ask question.