[lp_date_serverDST]

Description

Link: [lp_date_serverDST]
Author: Bil Corry
Category: Date
Version: 8.5.x
License: Public Domain
Posted: Dec. 06, 2005
Updated: Oct. 30, 2006
More by this author...
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]

Parameters

-date date, optional The date to check for DST. Default is today's date.

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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
[

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

10/30/2006, Bil Corry
Thanks!
I've updated the description to include the requirements.
09/07/2006, Daniel James
Requirements
The requirements are missing - [lp_date_stringtodate], [lp_date_UTCtoLocal]
Email:


Password:



Newest

Most Popular

Support tagSwap.net