Support » Plugin: TimeZoneCalculator » input American date format

  • Resolved highgatecreative

    (@highgatecreative)


    Hi, Is there an option to change the query_time to read an American date format (MM-DD-YYYY) instead of the European format (DD/MM/YYYY)?

    I’m using the plugin to generate regular lists of meeting times in half a dozen time zones using the query shown below:

    [timezonecalculator_output query_time=”01-11-2017 8pm” query_timezone=”America/New_York”]

    In the example above, since the plugin is reading the European date format, it outputs November when I intend for the date to be January.

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Bernhard Riedl

    (@neoxx)

    Hi again highgatecreative,

    I use PHP’s strtotime function in TimeZoneCalculator to retrieve the Unix timestamp for a given query_time.

    Here’s what the documentation says about this function:

    “Dates in the m/d/y or d-m-y formats are disambiguated by looking at the separator between the various components: if the separator is a slash (/), then the American m/d/y is assumed; whereas if the separator is a dash (-) or a dot (.), then the European d-m-y format is assumed. If, however, the year is given in a two digit format and the separator is a dash (-, the date string is parsed as y-m-d.

    To avoid potential ambiguity, it’s best to use ISO 8601 (YYYY-MM-DD) dates or DateTime::createFromFormat() when possible.”

    I’ve tested [timezonecalculator_output query_time="01/11/2017 8pm" query_timezone="America/New_York"] with PHP 7 and TimeZoneCalculator generates the timezone-block for the elevenths of January set in New York’s timezone.

    My Best,
    Berny

    Thanks for pointing that out. Sorry I missed it!
    Peace,
    Highgate

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘input American date format’ is closed to new replies.