Question by
LordGuille · Oct 02, 2016 at 01:29 PM ·
systemcheckdate
How to check the date?
I'm new to scripting and I'm making a game. In 8 days is my birthday and I want to add a easter egg. Im trying this: function Update () { if (System.DateTime.Now == ("10/02/2016")) { print("Easter egg activated!"); } } But it doesn't work :/ How can I make it work?
Comment
Answer by tanoshimi · Oct 02, 2016 at 01:32 PM
You need to compare the value to a DateTime, not a string. Something like this should work:
DateTime yourBirthday = new DateTime(2016, 10, 2);
if (System.DateTime.Today == yourBirthday ) { print("Easter egg activated!"); }