Hello,I get the Current Date now.
But I want show the month to Arabic numerals.
ex.Apr → 4
I use mid((Browser.ExecJS("Date()")),3,5)
to show the month.
Thanks!
I don't think you should be using Browser.ExecJS to do this. Instead use the date plugin
construct.net/en/make-games/manuals/construct-3/plugin-reference/date
Which has this
GetMonth(timeStamp) Extract the month (0 - 11) from the provided timestamp in local time.
GetMonth(timeStamp)
Extract the month (0 - 11) from the provided timestamp in local time.
So April would return 3 and all you have to do is add one
GetMonth(timeStamp)+1
I don't think you should be using Browser.ExecJS to do this. Instead use the date plugin https://www.construct.net/en/make-games/manuals/construct-3/plugin-reference/date Which has this > GetMonth(timeStamp) > Extract the month (0 - 11) from the provided timestamp in local time. So April would return 3 and all you have to do is add one GetMonth(timeStamp)+1
https://www.construct.net/en/make-games/manuals/construct-3/plugin-reference/date
> GetMonth(timeStamp)
> Extract the month (0 - 11) from the provided timestamp in local time.
Thank you!
But why my date always show "1"?
Here is my screenshot
Develop games in your browser. Powerful, performant & highly capable.
I got it.
use Date.GetMonth(Date.Now) + 1
I thought I had to enter some numbers, but I was mistaken. HA!
Exactly, you have to pass a timestamp into the function. This also allows you to get a month from the past or the future if you pass a timestamp into it that's not the current time.