Menu

Shortcut for Date insertion

2009-04-19
2012-11-13
  • Alejandro Ayunta

    how I can insert a Datetime in a edit page?

     
    • Thell Fowler

      Thell Fowler - 2009-04-19

      Settings -> Shortcut Mapper -> Plugins -> I:Date & Time

      I used the short fomat and mapped to ctrl-shift-d; use it all of the time.

       
      • ClarkJeff

        ClarkJeff - 2009-04-20

        Is there any way to insert the Date first, then the Time?  That way, I can sort in chronological order.  Currently, it appears to insert the Time first, then the Date.  Thanks.

         
    • cchris

      cchris - 2009-04-21

      A perhaps better and more flexible feature would be Insert "Date/Time using format 1-N". It would format a date/time string a bit like printf() in C, with some format strings stored in a config file. And "of course" ability to add/remove a format without going to the config file.

      Format specifiers could be:
      %s, %0s: seconds
      %m, %0m: minutes
      %h,%0h: hour
      %d,%0d: day
      %M,%0M,%3M,%+M: month
      %y,%+y: year
      %w,%3w,%+w: day of week
      %%: %
      other chars as is

      The unaltered modifiers (except %w and %y) display 2-digit stuff, or 1 if it fits. The %0 modifiers add a 0 if one digit is enough. This is the default behaviour for %y, so there is no %0y.
      %3 modifiers display 3-letter abbreviations as per current locale.
      %+ modifiers display long names as per locale. %+w can be aliased by %w, since using a digit for day of week isn't very common.

      How about that?

      CChris

       
      • Thell Fowler

        Thell Fowler - 2009-04-21

        That smells like an NppPlugin_InsertDate; config dialog to create a custom date string; save entry; delete entry; refresh menu ( which would add the string as a command item to the plugins sub-menu in the Plugins menu; then create a short-cut to it.

        Hell, you could even custom format the inserted dates regardless of the language style being used.

         
    • cchris

      cchris - 2009-04-22

      Exactly what I had in mind.

      Well, my C++ is very rusty, and I have tackled making the search/replace actions recordable in a macro. That takes some code refactoring, and VS2008 didn't like the way generic_string and TCHAR [] mix together - I'm not happy with the silencer I'm using. So it will be a while before I do this - you'll get it released before I start perhaps!

      CChris