Get date string from count of days since Epoch C#

c#, datetime, timespan

Solution

Adds a number of days to your epoch.

For example:

var epoch = new DateTime(...);  // Your epoch (01/01/0001 or whatever)
var yourDate = epoch.AddDays(days_since_epoch);

Problem

I have an integer `15791` which represents count of days since epoch and equals 27.03.2013, how can do this convert in C#? ``` public void method1() { ... int days_since_epoch = 15791; // how convert `days_since_epoch` to "27.03.2013" } ``` Thanks!

Original source

Related problems