Link | lp_date_getLocalTimeZone |
Author | Bil Corry |
Category | Date |
Version | 8.x |
License | Public Domain |
Posted | 26 Feb 2006 |
Updated | 02 Mar 2006 |
More by this author... |
Returns the timezone offset for the local server. Optionally may specify a date to take DST into account.
Requires [lp_date_stringtodate] [lp_string_pad] [lp_date_serverDST] [lp_date_stringToOffset]
lp_date_getLocalTimeZone: (date:'2/10/2006'); // returns -0800 for Pacific timezone '
'; lp_date_getLocalTimeZone: (date:'6/10/2006'); // returns -0700 for Pacific timezone
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_getLocalTimeZone', -description='Returns the timezone offset for the local server. Optionally may specify a date to take DST into account.', -priority='replace', -optional='date',-copy; // does not have a -long option, like it's Lasso counterpart [Date_GetLocalTimeZone] if: !(local_defined:'date'); local:'date' = date; /if; if: #date->type != 'date'; #date = lp_date_stringtodate: (string: #date); /if; if: (lp_date_serverDST: date) && (lp_date_serverDST: #date); // if same, easy return: (lp_date_stringToOffset: Date_GetLocalTimeZone); else: !(lp_date_serverDST: date) && !(lp_date_serverDST: #date); // if same, easy return: (lp_date_stringToOffset: Date_GetLocalTimeZone); else: (lp_date_serverDST: date) && !(lp_date_serverDST: #date); // server in DST, date is not local:'hour' = (lp_date_stringToOffset: Date_GetLocalTimeZone, -map)->(find:'hours'); #hour -= 1; // correct for DST local:'minute' = (lp_date_stringToOffset: Date_GetLocalTimeZone, -map)->(find:'minutes'); // return offset with DST taken into account return: (lp_date_stringToOffset: (string:#hour) (lp_string_pad: #minute,2)); else; // !(lp_date_serverDST: date) && (lp_date_serverDST: #date); //server not in DST, date is local:'hour' = (lp_date_stringToOffset: Date_GetLocalTimeZone, -map)->(find:'hours'); #hour += 1; // correct for DST local:'minute' = (lp_date_stringToOffset: Date_GetLocalTimeZone, -map)->(find:'minutes'); // return offset with DST taken into account return: (lp_date_stringToOffset: (string:#hour) (lp_string_pad: #minute,2)); /if; /define_tag; ]
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft