How can I change AM/PM to am/pm

I would like to insert time with a lower case am or pm. My insert time action is [[date|%-I:%M %p ]]. I have tried %P but this inserts %P. %p inserts AM (or PM in the afternoon). Is the time format fixed by my iPad IOS or can I change it by editing the action.

Apple’s date formatting routines do not support forcing case on AM/PM. They can come out lower or upper, but it’s based on regional locale settings - like, I think, U.K. English uses lower case.

You could force the output by scripting it. A script step like this would be equivalent of an “Insert Text” step:

let [st, len] = editor.getSelectedRange()
let s = draft.processTemplate("[[date|%-I:%M %p]]").toLowerCase()
editor.setSelectedText(s)
editor.setSelectedRange(st, s.length)
1 Like

Thanks for your quick reply. The solution looks a bit too difficult for me so I think I’ll just accept the AM/PM insertion - but thanks anyway.

Up to you…using that would only require you create an action with a “Script” step, and copy-paste that code snippet into it.

Thanks - I’m new to this and didn’t think I’d be able to create the action but I just tried and found it wasn’t as difficult as I first thought. Thanks for your help.

1 Like