You've successfully subscribed to Hacking with Unity - Learn how to create your own games
Great! Next, complete checkout for full access to Hacking with Unity - Learn how to create your own games
Welcome back! You've successfully signed in.
Success! Your account is fully activated, you now have access to all content.
Success! Your billing info is updated.
Billing info update failed.
It is quite common to see
Time used in the game, here are some frequently used methods:
Get the current date time
// Get the current date and time
DateTime currentDateTime= DateTime.Now;
Get date and time difference between two dates
// Get time difference between two date
DateTime oldDateTime = new DateTime(2020,1,1);
DateTime newDateTime= DateTime.Now;
TimeSpan ts = newDateTime - oldDateTime;
int diffDays = ts.Days;
Hacking with Unity - Learn how to create your own games Newsletter
Join the newsletter to receive the latest updates in your inbox.