Link | lp_date_toOffset |
Author | Bil Corry |
Category | Date |
Version | 8.x |
License | Public Domain |
Posted | 26 Feb 2006 |
Updated | 06 Sep 2006 |
More by this author... |
Returns the date at a specified timezone offset given a date in either UTC/GMT or local server timezone.
Requires [lp_date_stringtodate] [lp_date_localToUTC] [lp_string_getnumeric] [lp_date_stringToOffset]
(lp_date_toOffset: (date:'2/20/2006 12:00:00 GMT'), '-0500'); // returns 2/20/2006 07:00:00 '
'; (lp_date_toOffset: (date:'2/20/2006 12:00:00'), '-0500'); // returns 02/20/2006 15:00:00 for server local time offset of -0800
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_toOffset', -description='Returns the date at a specified timezone offset given a date in either UTC/GMT or local server timezone.', -priority='replace', -required='date',-copy, -required='timezone_offset'; // get date if: #date->type != 'date'; #date = lp_date_stringtodate: (string: #date); /if; // convert to UTC/GMT #date = lp_date_localToUTC: #date; // remove UTC/GMT marker #date = (date: #date->month '/' #date->day '/' #date->year ' ' #date->hour ':' #date->minute ':' #date->second); // return date at offset local:'hour' = (lp_date_stringToOffset: #timezone_offset, -map)->(find:'hours'); local:'minute' = (lp_date_stringToOffset: #timezone_offset, -map)->(find:'minutes'); if: (string:#timezone_offset)->(contains:'-'); #minute *= -1; /if; return: (date_add: #date, -hour=#hour, -minute=#minute); /define_tag; ]
No comments
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft