javascript - Date bookmarklet needs leading zero on single digit months and days -


I have a booklet that I use to check the daily log files. Although the bookmarklet used by me saves the month and day in only one issue, though the log files use double digits. For example, my bookletlet is delivered: While the log file actually lives:

Below is my current code:

 javascript: d = new% 20Date (); Window.open ("http: // url / log /" + d.getFullYear +) + "-" + (D.getMonth (+ 1) + "+" (d.getDate ()) + "_ localcontrol- Story.log ",% 20" _self "); 

Can you tell me an adaptation so to do this, I get my point and date in the 2-digit format, if necessary, with leading zero?

It's like a pain, but what I have done is to do stuff like this: / P>

  ("0" + d.getDate ()). Piece (-2)  

(add a leading zero and piece (-2) takes the last 2 characters)


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -