Date time again ...
I am using Notepad++ to log different stuff.
In this process I am using a keyboard sequence to insert time and date, but later on on when browsing through the file I would really love to get the date first.
So far I have not been able to swap time and date.
I would like it this way:
Not like this:
Are you using the TextFX (plugin) to insert the date/time that way? The TextFX (menu) -> TextFX Insert -> Date & Time - short format looks a lot like your example text, but also adds AM or PM between the time and date.
So if you’re willing to resort to programming, you can have whatever you want. For example, a little bit of Pythonscript yields your desired format, and could be tweaked even further to obtain virtually anything you can think of:
import datetime # see https://docs.python.org/2/library/datetime.html#strftime-and-strptime-behavior for format codes editor.addText(datetime.datetime.now().strftime("%m.%d.%Y %H.%M"))
@Scott-Sumner, I think the code would actually be in this format (Day.Month.Year):
@Frank-Sønslien, if you’re willing to do a regular expression, this should do it:
You are back again! Nice. Stop going away. :-D
You are right about the date ordering, according to what the OP wanted. However, whenever I see 11.05 I think of November 5 and not May 11, as Nov. 5 is my anniversary!
Larsen E Whipsnade
@Frank-Sønslien My NPP seems to read the date in ISO format from my Windows system date; I’d prefer to pick off the correct Windows date+time rather than patch the erroneous NPP display with Pythonscript or other patch tool
Notepad++ doesn’t do anything at all involving the date, so there is no “erroneous NPP display”. If you are talking about the date string that comes from the TextFX plugin, that’s fine but that isn’t a complaint against Notepad++. Actually, I can’t really tell what your complaint is as you don’t provide much in the way of detail.