I am working on a project that requires me to be comparing the date stored as string in database to the current date.
This particular application works in localhost but on live server, it seems to be picking the date of the server. I am resident in West Central Africa. How do i get the Date returned by my converted timezone in the format dd/MM/yyyy and not MM/dd/yyyy that it is seeing it.
Below is a code snippet.
var date = DateTime.UtcNow ;
var zone = TimeZoneInfo.FindSystemTimeZoneById("W. Central Africa Standard Time");
DateTime currentTime = TimeZoneInfo.ConvertTimeFromUtc(date, zone);
var loanDates = currentTime.Date;
var OldloanDate = loanDates.ToShortDateString();
var nloanDate = DateTime.ParseExact(OldloanDate, "dd/MM/yyyy", CultureInfo.InvariantCulture).Date;
var loanDate = nloanDate.ToShortDateString();
I want the loanDate to be in string form and of the format dd/MM/yyyy