Forum:Timestamp through template

I was trying to add a timestamp to my  template, so that when it would get added to a page, it would also add a small notice saying "Page tagged for deletion on date of template added to the page here". At first I thought I could get this done easily by substituting either the #time function, signature, or  magic word. None of this worked. After that I tried adding the timestamp without the substitution, as seperate template parameter. Failed again. Lastly, I tried using an additional template which would add a timestamp - again without success. I ended up confused with the parsing order, substitution and convinced that while testing I overlooked something.

My question is - is anyone able to add a timestamp to a template, that would mark the date on which the template was added to a particular page? Preferably without the use of additional template parameters and scripts. Thanks — Sovq 15:08, June 27, 2011 (UTC)


 * The only way I can think of doing this is with another parameter. I believe  would give you what you want, although I'm not sure.


 * Nah, that's not it, thanks though. It puts the timestamp on the template page but not on the target page. Here's a test template for it and here's the target page which can be edited at will, should anyone feel like solving the puzzle. — Sovq 18:31, June 27, 2011 (UTC)


 * What if you incorporate this in your template:

- 0 hours Which produces:"9:14AM, June 28, 2011"You can toy around with the order and the variables/parameters, all of which you can find here. Hope this helps. — Spike  Toronto  09:14, June 28, 2011 (UTC)


 * P.S. That expression may need  tags around it. If so, then this would be the code:

- 0 hours Try it both with and without. — Spike  Toronto  09:19, June 28, 2011 (UTC)

- 0 hours the timestamp was 'branded' on the template page and the target page would only transclude the already 'fixed' date. While - 0 hours doesn't parse the function on the target page and displays the raw code on it. Thanks for trying though.
 * When I added


 * I found that the only solution is to make the user adding the template either substitute the template itself or substitute a template date parameter ( "" for example 'substitutes' itself). A timestamp cannot be automatically substituted through a template, so the puzzle is unsolvable IMO.

This template has been added on to the template (inside a few string and parser functions to make sure the parameter was indeed a date in a proper format) and change the template documentation page, to make the users use: . — Sovq 10:01, June 28, 2011 (UTC)
 * Should anyone have a similar problem, the closest to what I wanted was that I added:


 * If substituting the template gives you your timestamp, then requiring people to substitute it is not such a bad thing. It’s hardly onerous. Plus, there are ways to ensure that they perform the substition. For instance, in this template, we have a failsafe  statement that displays a subsitution warning in big red letters should the person using the template not substitute it (also, visible during Preview). Also, at the top of your template’s documentation, you could put notices like this or this to act as additional reminders. —  Spike  Toronto  12:12, June 28, 2011 (UTC)


 * The problem is that I can't have the rest of the template substituted. I was just interested in a timestamp. The template gets adjusted frequently and I want all the transcluded templates out there to look the same, which is impossible if the users will substitute it.


 * I was hoping to find a solution that wouldn't require any additional work from the user when adding the template, but I guess that's impossible. — Sovq 12:33, June 28, 2011 (UTC)

When I have some time, I’ll browse through our 52,001 templates and see if there are any with timestamps. I was looking at one that wasn’t so much timestamping, as indicating how long it had been since the page on which the template is placed had been edited. It did so by using the  magic word and then formatting the output into normal dateform. — Spike  Toronto  12:49, June 28, 2011 (UTC)