Formatting DateTime in VIM without leading zeroes on Month, Day, and Hour -


Do anyone know that there is no way to format the date generated by striptime (under MS Windows) in the remit, Just like the month, day, and hour are not the two digit numbered padded ones?

For example, vimrc:

  nmap & lt; F3 & gt; A & lt; C-R & gt; = Step ("% I:% M% p% m /% d /% Y") & lt; CR & gt; & Lt; Esc & gt; IMAP & LT; F3 & gt; & Lt; C-R & gt; = Step ("% I:% M% p% m /% d /% Y") & lt; CR & gt; In the file  

will be printed

  03:32 AM 07/09/2010  

In fact, July 9 < / P>

I would like to know if there is a format string that will print

  3:32 am 7/9/2010  

for this Instead of Vim I know that strftime is platform-specific, so I'm looking for a Windows-specific solution, without the use of external equipment, I also appreciate the comments of those effects which Sector is impossible.

Thank you.

Some operating systems are respectively % k for hours and days of single digits And support % e . None of these are supported on Windows (or not in Windows XP, at least, which I got close to passing it).

But not all have lost Windows support % x , which gives you the desired date in the format 7/9/2010 , and we Any leading zeros with the call can get rid of replacement () :

  resonance options (striptime ("% I:% M% p% x") , "^ 0", "", "")  

this prints

  3:50 am 7/19/2010  

Keep in mind that all this is specific not only on OS, but also for the existing locale. This is not portable at all.


Comments