Skip to content

miyako/4d-plugin-tz

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 

Repository files navigation

4d-plugin-tz

Perform conversion and arithmetic on dates

based on Time Zone Database Parser

similar project: time-and-number

Platform

carbon cocoa win32 win64

Version

preemption xx

Note: The timezone database and windowsZones.xml are preinstalled locally in Resources/tzdata.

Syntax

zones:=TZ Get zones
Parameter Type Description
zones TEXT json
result:=TZ Convert (time;fmt_in;zone_out;fmt_out)
Parameter Type Description
time TEXT
fmt_in TEXT strftime
zone_out TEXT
fmt_out TEXT strftime
offset LONGINT seconds

Examples

  //RFC to ISO conversion (specify format only)

$time:="Sun Sep 16 01:03:52 -0500 1973"
$fmt_in:="%a %b %d %T %z %Y"
$zone_out:=""
$fmt_out:="%FT%TZ"

$utc:=TZ Convert ($time;$fmt_in;$zone_out;$fmt_out)
  //1973-09-16T06:03:52.000Z

  //RFC to ISO conversion in zone (specify format and zone)

$time:="Sun Sep 16 01:03:52 -0500 1973"
$fmt_in:="%a %b %d %T %z %Y"
$zone_out:="Australia/Sydney"
$fmt_out:="%FT%T %Z"

$aest:=TZ Convert ($time;$fmt_in;$zone_out;$fmt_out)
  //1973-09-16 16:03:52.000 AEST
  //duration over time zone change 

$departure:="1978-12-30 12:01:00 -0500"
$fmt_in:="%F %T %z"
$fmt_out:="%F %T %z"
$zone_out:="Asia/Tehran"
$flight:=?14:44:00?

$arrival:=TZ Convert ($departure;\
$fmt_in;\
$zone_out;\
$fmt_out;\
$flight+0)
  //1978-12-31 11:45:00.000 +0400

  //day later...
$departure:=TZ Convert ($departure;\
$fmt_in;\
"America/New_York";\
$fmt_out;\
?24:00:00?+0)
  //1978-12-31 12:01:00.000 -0500

$arrival:=TZ Convert ($departure;\
$fmt_in;\
$zone_out;\
$fmt_out;\
$flight+0)
  //1979-01-01 11:15:00.000 +0330

About

Perform conversion and arithmetic on dates

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published