Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Date Format in Core

$
0
0

Hi,

Why is the date formatting in a 24-hour format is not working in Core?

//myUTCDate = 2017-06-29 10:54:34.4880001 <<--from db

TimeZoneInfo tz = TimeZoneInfo.FindSystemTimeZoneById('AUS Eastern Standard Time');

var newDate = TimeZoneInfo.ConvertTime(myUTCDate, tz, TimeZoneInfo.Utc)

var formatDate = newDate.ToString("dd/MM/yyyy HH:mm:ss", CultureInfo.InvariantCulture) //get a 24-hour format

//value for formatDate is 06/29/2017 1:19:35 <<--not right, suppose to be 06/29/2017 19:19:35

Look at the return hour value, it becomes "1" it must be "19". Any thoughts?

Thanks,


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>