[lp_date_offsetToUTC]
Description
Returns the date at UTC/GMT given a date with a specified timezone offset.
Requires [lp_date_stringtodate] [lp_string_getnumeric] [lp_date_stringtoOffset]
Parameters
-date
date, required
The date to convert to UTC/GMT.
-timezone_offset
string, required
The timezone offset. In the format +hhmm or -hhmm.
Sample Usage
(lp_date_offsetToUTC: (date:'2/20/2006 7:00:00'), '-0500'); // returns 02/20/2006 12:00:00 GMT
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
[
define_tag:'lp_date_offsetToUTC',
-description='Returns the date at UTC/GMT given a date with a specified timezone offset.',
-priority='replace',
-required='date',-copy,
-required='timezone_offset';
if: #date->type != 'date';
#date = lp_date_stringtodate: (string: #date);
/if;
#date = (lp_date_utcToLocal: #date);
local:'offset' = (lp_date_stringToOffset: #timezone_offset, -map);
local:'hour' = #offset->(find:'hours');
local:'minute' = #offset->(find:'minutes');
if: (string:#timezone_offset)->(contains:'-');
#minute *= -1;
/if;
#hour *= -1;
#minute *= -1;
#date = (date_add: #date, -hour=#hour, -minute=#minute);
// add UTC/GMT marker
#date = (date: #date->month '/' #date->day '/' #date->year ' ' #date->hour ':' #date->minute ':' #date->second ' GMT');
return: #date;
/define_tag;
]
Related Tags
Comments
none
Newest
Most Popular
Support tagSwap.net