[Solved] Current date and time in variable

Is there a way to get current date and time in a variable in my game?
if yes then how Help please


JavaScript event with this line of text: runtimeScene.getVariables().get(“variable name”).setString(Date.now().toString())

If I past

This text in javascript consol of gdevelop will this work in android…

Actualy I am trying to make and action like " if current time is 4:00 pm" = “Hide object Moon”

What I gave you is code to store the current date and time on a scene variable

cant i use it in expressions in variableS?

You can use this expressions, search “Time” on webpage with CTRL+F


WELL CAN YOU TELL ME HOW TO DO THIS? " if current time is 4:00 pm" = “Hide object Moon”

Small caps are pretty appreciated :robot:

1 Like

ToString(Time("hour")) + ":" + ToString(Time("min"))
Display like : 20h24 for me because i’am living in France i don’t know for other country.
After that you need create your own function for create a condition with this expression.


what about date? if i wanna check whether this is today’s date?

Open the expression editor select a function and read the description.