Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Get The Unix Epoch Time In One Line Of C#

DZone's Guide to

Get The Unix Epoch Time In One Line Of C#

One line of C#, so much awesomeness: The Unix epoch time.

· Java Zone
Free Resource

Download Microservices for Java Developers: A hands-on introduction to frameworks and containers. Brought to you in partnership with Red Hat.


int epoch = (int)(DateTime.UtcNow - new DateTime(1970, 1, 1)).TotalSeconds;


Download Building Reactive Microservices in Java: Asynchronous and Event-Based Application Design. Brought to you in partnership with Red Hat

Topics:
java ,c# ,unix ,epoch time

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}