Jump to content
  • 0

Label Current Month


pmcfarlain

Question

2 answers to this question

Recommended Posts

  • 0
24 minutes ago, pmcfarlain said:

I'd like to make the label on my datapage display the current month. Is there a way I can do that?

1662145520_ScreenShot2021-08-20at10_25_16AM.png.edaeb60608b203dce5a7f06413390d61.png

Anything Dynamic in a Webpage needs JavaScript

Put this on your Label

<span id="CurrMonth"></span>

Then on Footer

<script>
var d = new Date();
var n = d.getMonth();

var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];


document.getElementById("CurrMonth").innerHTML = months[n];

</script>

getMonth returns 0 for January, 1 for February and so on

Link to comment
Share on other sites

  • 0
4 minutes ago, TellMeWhy said:

Anything Dynamic in a Webpage needs JavaScript

Put this on your Label

<span id="CurrMonth"></span>

Then on Footer

<script>
var d = new Date();
var n = d.getMonth();

var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];


document.getElementById("CurrMonth").innerHTML = months[n];

</script>

getMonth returns 0 for January, 1 for February and so on

Great, thanks!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...