DateTime documentation

Is there any help on how to use DateTime? I’m looking for a way to get a date in the format “2017-09-01 8:27am”.

thanks

DateTime can parse a number of relative formats as discussed here:

https://guide.taskpaper.com/reference/dates/index.html

But DateTime format output is limited to ISO standards. So flexible input, limited and standard output. There is a little flexibility on output. Here’s the actual formatting code:

if m.milliseconds() and showMillisecondsIfNeeded
  m.format('YYYY-MM-DD HH:mm:ss:SSS')
else if m.seconds() and showSecondsIfNeeded
  m.format('YYYY-MM-DD HH:mm:ss')
else if m.hours() or m.minutes()
  m.format('YYYY-MM-DD HH:mm')
else
  m.format('YYYY-MM-DD')

So if you give a date starting at midnight then you’ll just get YYYY-MM-DD, but if you include hours, seconds… it will add whatever is needed to represent the date in ISO format. There are also two undocumented boolean parameters to the format function that allow you to opt out and not show milliseconds or seconds even if they are included.