Calculate the sunset and sunrise time based on the date and the latitude/longitude.
The implementation is based on the algorithm found in these two links -
The project is available in nuget - https://www.nuget.org/packages/solar-calculator/
// Dhaka
var location = new
{
latitude = 23.777176,
longitude = 90.399452,
};
var theDate = new DateTime(2018, 1, 1); // Jan 1 2018
var results = theDate.Times(location.latitude, location.longitude, TimeSpan.FromHours(18)); // UTC offset for locale on Jan 1, not using daylight savings