Skip to content

Instantly share code, notes, and snippets.

@openroomxyz
Created April 10, 2020 09:30
Show Gist options
  • Select an option

  • Save openroomxyz/86e53982b9f02915f3be1302cdcc585e to your computer and use it in GitHub Desktop.

Select an option

Save openroomxyz/86e53982b9f02915f3be1302cdcc585e to your computer and use it in GitHub Desktop.
Unity : How to get number of seconds since 1970 ( Epochtime ) ?
public static int GetCurrentTime()
{
System.DateTime epochStart = new System.DateTime(1970, 1, 1, 0, 0, 0, System.DateTimeKind.Utc);
int cur_time = (int)(System.DateTime.UtcNow - epochStart).TotalSeconds;
return cur_time;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment