Link | lp_date_serverDST |
Author | Bil Corry |
Category | Date |
Version | 8.5.x |
License | Public Domain |
Posted | 06 Dec 2005 |
Updated | 30 Oct 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]
// 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;
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; ]
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft
Thanks!