Description
The documentation for AdjustToUniversal
says
If the input string denotes a UTC time, through a time zone specifier or AssumeUniversal, no conversion occurs.
This is not strictly true. When AssumeUniversal
is used with DateTimeOffset
:
If format does not require that input contain an offset value, the returned DateTimeOffset object is given the UTC offset (+00:00).
So AdjustToUniversal
indeed has no effect.
But when AssumeUniversal
is used for DateTime
:
Specifies that if s lacks any time zone information, it is assumed to represent UTC. Unless the DateTimeStyles.AdjustToUniversal flag is present, the method converts the returned DateTime value from UTC to local time and sets its Kind property to DateTimeKind.Local.
So AdjustToUniversal
will do the following conversation:
calls ToUniversalTime to convert the returned DateTime value to UTC, and sets the Kind property to DateTimeKind.Utc.