Seconds to date and time format

asp.net

Solution

Try this below code

DateTime date = new DateTime(1970,1,1,0,0,0,0); //Set default date 1/1/1970
date = date.AddSeconds(1365004800); //add seconds
label1.Text = date.ToString(); //Display result 2013-04-03 16:00:00

Problem

In c#, how can I convert seconds to date and time format.The date and time format is as follows. YYYY-MM-DD HH:MM:SS . I had time in seconds not in milliseconds. I want to convert 1365004800 to 2013-04-03 16:00:00

Original source

Related problems