The [DATE] tag has stopped working on 13/12/2019
Автор: Robert A.
Просмотрено 2121,
Подписчики 2,
Размещенный 0
Hello,
On my page: http://www.ex-l-ence.com/ - I use the [DATE] tag in a text object "Our bestselling title for the 30 days to [DATE] is ......... " - Why has it stopped working on the 13th - Superstitious? It was Friday the 13th :)
Thanks,
Robert.
Размещено
Автор
Hmmmm - I just uploaded the site again - and now it's updated???
Hello.Please specify your problem has already been resolved?
Автор
Hi Aleksej,
Sadly no it's not fixed - now it's stuck on the 20th ???
Show how exactly the object with this tag looks.
It seems that it is intended only to indicate the current date at the time of adding.
Автор
Hi Aleksej,
That's very odd as it WAS working for quite some time - I wondered if an upgrade to the software had changed it's behaviour?
Автор
The way I am using it is: On my page: http://www.ex-l-ence.com/ - I use the [DATE] tag in a text object "Our bestselling title for the 30 days to [DATE] is xxxxxx " - the xxxxxx is where I have to manually alter text if the bestselling book changes (which has not happened in over 3 months).
I meant send a screenshot of the program window, where I can see the tag itself.
"I wondered if an upgrade to the software had changed it's behaviour?" - may be.Maybe something has changed on the hosting.
Автор
Hello Aleksej,
Sorry for the delay in replying - away for Christmas & New Year - by the way - Happy 2020 to you.
Screen captures attached...
"Happy 2020 to you" - And you too!
Regarding your question.Everything seems to work right.The current date at the time the site is uploaded is inserted on the page.This tag will not help you to display the current date (without the daily unloading site).
Hello Robert
To show the actual date you could use this :
---------------------------------------------------------
<p style="margin: 0; display: inline;">Our bestselling title for the 30 days to</p>
<p style="margin: 0; display: inline;" id="date"></p>
<script>
n = new Date();
y = n.getFullYear();
m = n.getMonth() + 1;
d = n.getDate();
document.getElementById("date").innerHTML = m + "/" + d + "/" + y;
</script>
------------------------------------------------------------------
You can style the date format as you wish.
The example will ( for today/postdate) give this :
Our bestselling title for the 30 days to 1/3/2020
The code between the ---- should be put in a HTML-object.
Hope it was something like this you are looking for.
Example where the title is styled with a bigger font. You can also change colors and so - but be aware that it could look messy if too much styling is used.
<p style="margin: 0; display: inline;">Our bestselling title for the 30 days to</p>
<p style="margin: 0; display: inline;" id="date"></p>
<p style="margin: 0; font-size:300%; display: inline;">The BESTSELLER</p>
<script>
n = new Date();
y = n.getFullYear();
m = n.getMonth() + 1;
d = n.getDate();
document.getElementById("date").innerHTML = m + "/" + d + "/" + y;
</script>
Автор
Hello John,
Many thanks - your code gave me the answer, although I decided to simplify what I was showing on my site to last month's bestselling title and used:
<p style="margin: 0; display: inline;"><h5>Our bestselling title for last month</p>
<p style="margin: 0; display: inline;" id="date"></p><br>
<p style="margin: 0; display: inline;"><a href="http://www.ex-l-ence.com/miracles-on-the-camino.html">Miracles On The Camino</a></h5></p>
<script>
n = new Date();
var months = ["December","January", "February", "March", "April", "May", "June", "July", "August", "September", "October", ];
m = n.getMonth() + 1;
document.getElementById("date").innerHTML = months[n.getMonth()];
</script>
I left in some redundant code in case I want to play with the output some more :)
Have a great 2020 :)