Insert time only as hh:mm:ss



  • I have a need to insert just the time as hh:mm:ss (no date or AM/PM) + a space or - at the start of a line to record the exact time when I entered the text, so I can sync it up with pictures I took at the same time.

    I have already tried to create a macro that inserts the short format Date & Time as 8:12 AM 2/9/2016 using TextFx Insert, and then back spacing to erase the date. But apparently the backspace code executes before the full date gets written, ending up with only 2-3 characters of the insert. Even if it worked I would only get hh:mm and not hh:mm:ss.
    By using 2 shortcut keys, one for time/date, the other for backspaces, I can at least get hh:mm, but not a single key macro with seconds.

    How do I create a macro shortcut key that will only insert hh:mm:ss+space or -?

    Thanks, Ron



  • @Ron-Shaw

    I would use python script plugin and code like

    import datetime
    editor.appendText(datetime.datetime.today().strftime("%H:%M:%S"))
    

    to solve this. If you want to install this plugin I would recommend to use
    msi
    instead of
    plugin manager

    Cheers
    Claudia


Log in to reply