Last active
March 3, 2022 21:05
-
-
Save unitycoder/3724726ff932d966ef68 to your computer and use it in GitHub Desktop.
Format Time.time to HH:MM:SS - Date Time - CurrentTime
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// example: Debug.Log(FormatTime(Time.time)); | |
string FormatTime(int t) | |
{ | |
return System.TimeSpan.FromSeconds(t).ToString(); | |
} | |
// get current datetime formatted | |
DateTime.Now.ToString("dd/MM/yyyy"); | |
// date and time as stamp | |
DateTime.Now.ToString("ddMMyyyy_HHmmss") | |
// unix timestamp | |
DateTimeOffset.Now.ToUnixTimeSeconds(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment