UTC is the universal standard time, the so-called GMT, is zero time, the time that is independent of where it is.
This time zone information is not available on type DateTime
, therefore it cannot be obtained. I think it gets worse coming from the customer.
In general you should treat the date as UTC. Eventually you can convert to the local time. If save as local time (this is possible with DateTimeKind
), can find the difference to the UTC. Maybe this difference serves you for something but does not say what time zone is.
The only way is to have additional information to store this. It can be separated or create a new type that encapsulates the time and time zone. If the Javascript code does not get the local time information (and of course this is not something you can trust) and does not send it to the server, there is no solution, unless you consider the server time to be the same as the client, but it is a presumption that may be wrong. You have to send the time difference from the local time to the GMT time (UTC). With this additional information it is possible to make calculations on the local time of the client.
You can even use a library like Nodatime that has a more sophisticated type. But the information coming from the client needs to be compatible.
Do you want the time in UTC or do you want to know what the
TimeZone
hers?– Maniero
I want to know her Timezone, UTC has nothing to do with it?
– Jedaias Rodrigues