Lasso Soft Inc. > Home

[excel_date]

Linkexcel_date
AuthorDominique Guardiola Falco
CategoryDate
Version8.5.x
LicensePublic Domain
Posted11 Nov 2010
Updated11 Nov 2010
More by this author...

Description

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

 

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.

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

No comments

Please log in to comment

Subscribe to the LassoTalk mail list

LassoSoft Inc. > Home

 

 

©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft