Lasso Soft Inc. > Home

[lp_date_serverDST]

Linklp_date_serverDST
AuthorBil Corry
CategoryDate
Version8.5.x
LicensePublic Domain
Posted06 Dec 2005
Updated30 Oct 2006
More by this author...

Description

Returns true if a date is within Daylight Savings Time (Spring to Fall) for the TIMEZONE SETTING OF THE SERVER!

Requires [lp_date_stringtodate] [lp_date_UTCtoLocal]

Sample Usage

// examples for a server in the California timezone (Pacific)
lp_date_serverdst: '4/5/2003'; // returns 'false'
lp_date_serverdst: '4/6/2003'; // returns 'true'
lp_date_serverdst: '10/25/2003'; // returns 'true'
lp_date_serverdst: '10/26/2003'; // returns 'false'
lp_date_serverdst;

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:'lp_date_serverDST',
	-description='Returns true if a date is within Daylight Savings Time (Spring to Fall) for the TIMEZONE SETTING OF THE SERVER!',
	-priority='replace',
	-optional='date', -copy;

	// examples for a server in the California timezone (Pacific)
	// lp_date_serverdst: '4/5/2003'; // returns 'false'
	// lp_date_serverdst: '4/6/2003'; // returns 'true'
	// lp_date_serverdst: '10/25/2003'; // returns 'true'
	// lp_date_serverdst: '10/26/2003'; // returns 'false'
	// lp_date_serverdst;

	if: !local_defined:'date';
		local:'date' = date;
	else: #date->type != 'date';
		#date = (lp_date_stringtodate: (string:#date));
	/if;

	if: #date->dst === -1;
		// there's a bug in LP8/LP8.5 that prevents certain dates from reporting DST correctly
		// so workaround the problem:
		if: #date->gmt;
			#date = (date: #date->month '/' #date->day '/' #date->year ' ' #date->hour ':' #date->minute ':' #date->second ' GMT');	
		else;
			#date = (date: #date->month '/' #date->day '/' #date->year ' ' #date->hour ':' #date->minute ':' #date->second);		
		/if;
	/if;

	#date = lp_date_UTCtoLocal: #date;

	if: #date->dst === 1 || #date->dst === true;
		return:'true';
	/if;

	if: #date->dst === 0 || #date->dst === false;
		return:'false';
	/if;

	fail:-1,'Unknown DST';

/define_tag;

]

Comments

30 Oct 2006, Bil Corry

Thanks!

I've updated the description to include the requirements.

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