Lasso Soft Inc. > Home

[DT_Date]

LinkDT_Date
AuthorRick Draper
CategoryDate
Version8.x
LicensePublic Domain
Posted05 Feb 2006
Updated05 Feb 2006
More by this author...

Description

This tag was created to overcome a problem where events were stored on one server in GMT, but expected to be presented in the time zone applicable to the local time of the event.  ie. taking into account daylight saving / summer time. 

The tag accepts a single date/time in Lasso GMT format. 

An array of Daylight Saving / Summer Time start and finish dates is required in GMT format.  eg. Var:'VIC_DST'=(array: (map:(DST_End)=(04/01/2006 17:00:00 GMT), (DST_Start)=(10/01/2005 16:00:00 GMT)), (map:(DST_End)=(03/26/2005 17:00:00 GMT), (DST_Start)=(10/30/2004 16:00:00 GMT)), (map:(DST_End)=(03/27/2004 17:00:00 GMT), (DST_Start)=(10/25/2003 16:00:00 GMT)))

The relevant offsets from GMT for Standard and Summer Time are set as parameters.

This is my first tag, so all feedback and suggestions will be most welcome.

Sample Usage

Var:'Display_Date'=
	(DT_Date:
	-Date_GMT=' '10/02/2005 02:00:00',
	-DST_Array=$VIC_DST,
	-STD_TZ='AEST',
	-STD_Offset=10,
	-DST_TZ='AEDST',
	-DST_Offset=11,
	-Format='%d %b %Y %h:%M%p');

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:
'Date',
-Namespace='DT_',
-Required='Date_GMT',
-Type='Date',
-Required='DST_Array',
-Type='Array',
-Required='STD_Offset',
-Type='Integer',
-Required='STD_TZ',
-Type='String',
-Required='DST_Offset',
-Type='Integer',
-Required='DST_TZ',
-Type='String',
-Required='Format',
-Type='String'; 

Local:'Season_Set'=0;
Local:'Adjusted_Date'=(Date_Add:(#Date_GMT),-Hour=#STD_Offset);
Local:'Time_Zone'=#STD_TZ;

Iterate: #DST_Array, (Local: 'Date_Set');
	Local:'Start_GMT' = (#Date_Set->(Find:'DST_Start'));
	Local:'End_GMT' = (#Date_Set->(Find:'DST_End'));

	If:#Season_Set == 0;
		If:(Date_Difference: #Date_GMT, #Start_GMT, -Second) >= 0;
			#Season_Set = 1;
			If: (Date_Difference: #Date_GMT, #Start_GMT, -Second) >= 0 && (Date_Difference: #Date_GMT, #End_GMT, -Second) < 0;
				#Adjusted_Date = (Date_Add:#Date_GMT,-Hour=#DST_Offset);
				#Time_Zone = #DST_TZ;
			/If;
		/If;
	/If;
/Iterate;

Return:(Date_Format:#Adjusted_Date,-Format=#Format)+' '+#Time_Zone;
/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