RFC3339 to DateTime
Title says it, I can't find anything online for RFC3339 to Datetime, only the reverse
18 Replies
Isn't RFC3339 just spicy ISO-8601?
If so, then
DateTime.Parse()
will handle it
If that doesn't work, DateTime.ParseExact()
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
Just out of curiosity: why DateTimeOffset?
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
$datetimelie
please please please get into the habit of using DateTimeOffset instead of DateTime in your code everywhere you possibly can. DateTimeOffset contains the UTC offset with the data so is lossless. DateTime is very very weird in how it stores data. DateTime only knows UTC and "local" time. But your local time zone can change! Laptops easily move across state lines, even while an app is currently running. (So you are in California running an app, put some DateTime instance in memory, hop on a plane to New York, then resume your app 3 time zones ahead. What on earth will be contained within the DateTime instance?) But wait, this was a lie. DateTime actually has 3 ways it keeps track of time: UTC, local (which can change while an app is running), and unspecified (unknown, essentially). (Unknown = I don't know if it's UTC or local, the app will figure it out later and call ToUniversal or ToLocal before calling ToString or any comparison routine.) But wait, this was a lie. DateTime actually has a secret fourth way of storing data that's not exposed in the standard API surface! It's truly an abomination of a type. All of this nonsense is irrelevant if we just pretend DateTime doesn't exist and we instead use DateTimeOffset everywhere.- GrabYourPitchforks (start: https://discord.com/channels/143867839282020352/143867839282020352/988353756108312607)
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
Thank you for the info.
Didn't know that
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
You mean my timezone?
It's UTC + 2
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
Sorry, but what if I'm using DateTime everywhere because I'm only working with UTC
Is that still a bad thing?
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
Yes, that is right
I think currently it's a format for me.
I didn't know about Datimeoffset or the RFC Document.
Unknown User•3mo ago
Message Not Public
Sign In & Join Server To View
If you have no further questions, please use /close to mark the forum thread as answered