Components All New MacOS Windows Linux iOS
Examples Mac & Win Server Client Guides Statistic FMM Blog Deprecated Old

XL.Date.Pack

Packs date and time information into double type.

Component Version macOS Windows Linux Server iOS SDK
XL 3.5 ✅ Yes ✅ Yes ✅ Yes ✅ Yes ✅ Yes
MBS( "XL.Date.Pack"; bookRef; year; month; day { ; hour; minute; second; msec } )   More

Parameters

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

Result

Returns timestamp number or error.

Description

Packs date and time information into double type.

Examples

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)]

See also

This function checks for a license.

Created 18th August 2014, last changed 9th July 2015


XL.Date.DoubleToTimeStamp - XL.Date.TimeStampToDouble