Java Time Zones

6 0

Converts dates between time zones. Re-formats dates. Performs date arithmetic according to calendar.

Project Description

The extensions manages dates via Java built-in classes: GregorianCalndar, TimeZone, SimpleDateFormat, Locale. Extension's functions: =============== [Array] means an array formula i.e. press [Ctrl+Shift+Enter] * Date string functions jtz_date_reformat jtz_date_add jtz_date_tz jtz_date_tz_offset jtz_date_is_dst jtz_date_parse jtz_date_split [Array] * Unix time (milliseconds) functions jtz_unix_add jtz_unix_now jtz_unix_format jtz_unix_is_dst jtz_unix_split [Array] jtz_unix_tz_offset jtz_unix_timer jtz_unix_timer_split [Array] * Information functions jtz_format_codes [Array] jtz_loc_ids [Array] jtz_tz_ids [Array] jtz_tz_loc jtz_tz_info [Array] jtz_tz_by_raw_offset [Array] * Values in milliseconds jtz_mls_hour jtz_mls_minute jtz_mls_second * Date fields jtz_f_year jtz_f_month jtz_f_day jtz_f_hour jtz_f_minute jtz_f_second jtz_f_millis jtz_f_raw_offset jtz_f_dst_offset jtz_f_total_offset About time zones =========== * Greenwich Mean Time (GMT) is an absolute time reference and it doesn't change with the seasons. Each time zone has constant RAW offset from GMT. But some of them use an additional offset called Daylight Saving Time (DST). Finally, we can say that each time zone has TOTAL_OFFSET = RAW_OFFSET + DST_OFFSET. Some zones don't use DST i.e. DST_OFFSET = 0 * Unix time is defined as the number of milliseconds from: "1970-01-01 00:00:00.000 GMT" * A point in time expressed as Unix time has the same graphical representation in all time zones. On the other hand, a point in time expressed as "plain date" can vary depending on a time zone, e.g. a Unix time: "1319568508751" in Poland means: "2011-10-25 20:48:28.751 CEST" but in Greece: "2011-10-25 21:48:28.751 EEST" So, all three dates describe the same point in time despite they have different graphical representations. Priority and default values of parameters ============================ * A time zone can be read from a date using "z" format code or it can be given by "time zone ID" parameter. Remember, time zone in a date format ("z" code) has higher priority than "time zone ID" i.e. if a date format contains "z" then "time zone ID" parameter is ignored. * If a date format doesn't contain "z" code and "time zone ID" parameter is skipped or it's empty then "GMT" time zone is used. * If "locale ID" parameter is skipped or it's empty then a default locale of your Java Virtual Machine is used. * Note a subtle thing that a time zone included in a date string e.g. (CET or CEST) carries more information that a time zone given by its ID e.g. "Europe/Warsaw". Most of the time there is no difference except the moment of DST change. E.g. in year 2011 in "Europe/Warsaw" we disabled DST at: "2011-10-30 03:00:00.000 CEST" by pushing back clocks to: "2011-10-30 02:00:00.000 CET" Finally if we have only time zone ID like: "Europe/Warsaw" and any time between: "2011-10-30 02:00:00.000" and "2011-10-30 03:00:00.000" we don't know if it is: "CEST" or "CET" Finally, use a time zone included in a date ("z" format code) wherever possible. If you have a date with a general time zone ID only, be careful because sometimes it is not strict. Tutorial: ======= * Get unix time In: jtz_unix_now() Out: 1319568508751 * But what does it mean in Poland? In: jtz_unix_format(1319568508751; "yyyy-MM-dd HH:mm:ss.S z"; "Europe/Warsaw") Out: 2011-10-25 20:48:28.751 CEST * In Greece? In: jtz_unix_format(1319568508751; "yyyy-MM-dd HH:mm:ss.S z"; "Europe/Athens") Out: 2011-10-25 21:48:28.751 EEST * How to read date format? In: jtz_format_codes() [Array] Out: G | Era designator ... Date format codes are case sensitive, "M" is for moth but "m" is for "minute". Some codes can be repeated e.g. "MMM" gives short month name, "MMMM" gives long month name. * Where can I find time zones IDs like "Europe/Warsaw"? In: jtz_tz_ids() [Array] Out: ACT | CST | Central Standard Time (Northern Territory) | CST | Central Summer Time (Northern Territory) ... where columns mean: [1] time zone ID [2] short RAW name [3] long RAW name [4] short DST name [5] long DST name You can search for particular time zone ID: In: jtz_tz_ids(0; "en"; "Eur"; "Wars") [Array] where parameters are: [1] if ( 1) then search is performed only in default locale, if (== 1) then search is performed in ALL locales supported by Java [2] output locale; Time zones IDs are the same in all locales but time zones names can differ. [3] search string [4] search string [...] more search strings To Be Continued...

Category/Categories

Calc Extension

Logo

Current Release

Java Time Zones - 0.2.0

Released Oct 31, 2011 — tested with:

LibreOffice 3.4,

Before installation please remove previous version and restart L/OOo
More about this release…

javatimezonesaddin_0.2.0.oxt
File size: 52 kb
javatimezonesaddin_0.2.0.oxt
File size: 214 kb

All Releases

Version

Released

Platform(s)

Compatibility

Description

License(s)

Status

0.2.0

Oct 31, 2011
    • LibreOffice 3.4
    Before installation please remove previous version and restart L/OOo
    • GNU-GPL-v3+ (General Public License Version 3 and later)
    final

    0.1.1

    Oct 30, 2011
      • LibreOffice 3.4
      Bugfixes for 0.1.0
      • GNU-GPL-v3+ (General Public License Version 3 and later)
      final

      0.1.0

      Oct 25, 2011
        • LibreOffice 3.4
        First release.
        • GNU-GPL-v3+ (General Public License Version 3 and later)
        final

        Legal Disclaimer and Limitations for Downloads

        The Document Foundation has not reviewed, and cannot review, all of the material, including computer software, available on or by means of The Document Foundation's
        websites, and cannot therefore be responsible for that material's content, use or effects. By operating its websites, The Document Foundation does not represent or imply that it endorses the material there available, or that it believes such material to be accurate, useful or nonharmful. You are responsible for taking precautions as necessary to protect yourself and your computer systems from viruses, worms, Trojan horses and other harmful or destructive content. The Document Foundation's websites may contain content that is offensive, indecent or otherwise objectionable, as well as content containing technical inaccuracies, typographical mistakes and other errors. The Document Foundation's websites may also contain material that violates the privacy or publicity rights, or infringes the proprietary rights, of third parties, or the downloading, copying or use of which is subject to additional terms and conditions, stated or unstated. The Document Foundation disclaims any responsibility for any harm resulting from the use by The Document Foundation's visitors of The Document Foundation's websites, or from any downloading by those visitors of content available on or by means of The Document Foundation's websites.

        Changes

        Content contained on The Document Foundation's websites, including these Legal Disclaimers and Limitations, may be changed at the sole discretion of The Document Foundation and without notice. You are bound by any such updates or changes, and so should periodically review these Legal Disclaimers and Limitations.

        If you believe any file is present on the site contrary to any TDF rule or applicable law, please supply full details to info@documentfoundation.org for impartial consideration.