Unable to capture GMT+8

Here is the code:

New DateTimeOffset(DateTime.Now).ToUniversalTime().DateTime.ToString(“ddd MMM d hh:mm:ss ‘GMT+8’ yyyy”)

Output timezone is GMT not GMT+8:

I want to capture the exact GMT+8


To get gmtplus 8 first get the utc time using touniversaltime and then add 8 hours to it

Now.ToUniversalTime.Addhours(8).ToString("MM/dd/yyyy hh:mm:ss")

Or if you want to convert using time zone try this

TimeZoneInfo.ConvertTime(DateTimeOffset.Now, TimeZoneInfo.FindSystemTimeZoneById("Taipei Standard Time")).ToString.("MM/dd/yyyy hh:mm:ss")


Hello @joscares
Try this

datetime.UtcNow.AddHours(+8).ToString("dd MMM yyyy HH:mm")


1 Like

this works tnx!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.