[excel_date]

Description

Link: [excel_date]
Author: Dominique Guardiola
Category: Date
Version: 8.5.x
License: Public Domain
Posted: Nov. 11, 2010
Updated: Nov. 11, 2010
More by this author...

MS Excel uses a numeric format, called Serial Date format, when storing and dealing with dates and times. Serial date is calculated by taking a given date and determining the number of days that have passed since that date and 01-Jan-1900 (actually 00-Jan1900, but don't ask me, I don't know nothing about this).

 

Parameters

-s integer, required The serial date found in the XLS or XLSX document
-d date, required The lasso date to be converted in Excel serial date format

Sample Usage

//convert a serial date integer from an excel file to a lasso date
date_format(excel2lasso_Date(40617),-format='%d/%m/%Y');

//convert a lasso date for inclusion in an excel file
lasso2excel_Date(date('2011-03-15'));
						

Source Code

Click the "Download" button below to retrieve a copy of this tag, including the complete documentation and sample usage shown on this page. Place the downloaded ".inc" file in your LassoStartup folder, restart Lasso, and you can begin using this tag immediately.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
define_tag('excel2lasso_date', -required='s',-type='integer');
	local('t') = date('1900-01-01');
	local('d') = integer(#s - 2);
	local('result') = date(date_add(#t,-day=#d));
	return(#result);
/define_tag;

define_tag('lasso2excel_date', -required='d',-type='date');
	local('s') = date_difference(#d,'1900-01-01',-day);
	local('result') = integer(#s + 2);
	return(#result);
/define_tag;

 

Comments

none

Email:


Password:



Newest

Most Popular

Support tagSwap.net