Skip to main content

Extend Format Date activity with ArcGIS formats

Planned

Comments

5 comments

  • Ken Lyon

    You might be able to find a locale that give you what you want. I know that the date part you're describing is the same as we use in Canada, so this would work:

    =(new Date()).toLocaleDateString("en-CA")

    You'd need to just double check it doesn't convert the time zone or anything, but I think the locale is purely about formatting here.

    0
  • Berend Veldkamp

    Thanks Ken,

     

    I hadn't expected any locale to use y-m-d format, but there you go :-) 

    If I need both the date and the time, it is also shorter than my initial approach, but still a bit cumbersome, e.g. 

    =(new Date()).toLocaleDateString("en-CA") + “ ” + (new Date()).toLocaleTimeString("nl-NL"), 

    or (as UTC)

    =(new Date()).toISOString().replace(/[TZ]/g, ' ')

    I think the extra output to Format Date can still be useful. This could also deal with a timezone conversion. As you probably know, ArcGIS uses UTC by default, so an extra boolean input Convert to UTC could help here.

    0
  • Ken Lyon

    Yes, I quite like the official Canadian date format. Things like receipts can often be a mix of d/M/y and M/d/y which is pretty confusing but any time I see a four-digit number at the start, I know what I'm dealing with! 

    Maybe instead of a new output, a different value for the format input would be appropriate.

    Something like format: “esri” maybe?

    I don't think I want to introduce UTC conversion here as I don't want to stray from formatting into conversion. I'd rather focus on the new Calculate Date activity for that sort of thing.

    1
  • Berend Veldkamp

    Sounds all good to me

    0
  • Ken Lyon

    This has been added to the backlog. (User Story #312336)

    I think we could support something similar to Microsoft's Custom date and time format strings.

    0

Please sign in to leave a comment.