how can i format this date in sql to show it prope...
# sql
s
how can i format this date in sql to show it properly including if there is any timezone 2023-06-19T151016.381+00:00 using sql server 2014
s
i want to do inh sql, not in CF
z
so what do the mssql docs say?
s
i can use format but it does seems o take into consideration the +00:00
a
Did you at least google "sql server 2014 date type with timezone" and see what the docs say? You don't indicate that you did? If you had, I would assume you'd be posting with something along the lines of "I tried x and expected y, but instead z happened". And you'd post example code, etc. But as you didn't do that, I am guessing you are not even at the state of having read the docs or tried anything. Go do that first and get back to us.
I think your question is dubious though. "how can i format this date in sql". A DB server is a storage mechanism, not a display mechanism, so "formatting" doesn't come into it. Do you want to know how to pass a value in an SQL statement (which intrinsically needs to be a string) in a format that the DB can understand as a datetime with timezone? Do you want to know how to store a datetime with timezone in the DB? (you probably don't, you would store it as UTC and then apply a timezone when you need to present it to a human) Something else?
Conceptually, you probably want to read and absorb all of this lot before you post a clearer question: https://stackoverflow.com/a/69247024 (I got to that from googling "sql server 2014 storing timezone")
s
it seems the details i provide does not have enough information for you, i said above i said about format whcih is a sql function and that does not did what i expected
and i checke datetimeoffset
nothing works, so i poasted here
so not sure what moe you nexpect
a
1. put more effort into your comms: those last few messages of yours are a mess. 2. exactly what I asked. So perhaps you need to spend more time reading other ppl's comms as well. From the last lot:
format
... what did you try? How are you expecting us to guess? Also: you didn't say you were using that specific function, you simply said "how do I format..."
dateTimeOffset
... what did you try? How are you expecting us to guess? How do we know if what you tried made sense? How do we know what else to suggest? How can we possibly spot what you might have done wrong? "nothing works"... you haven't shown us anything, so how can we possibly know what didn't work? What I / we expect from you is for you to put some effort into asking us for help with your issues. Same thing we always expect. Same thing you hardly ever actually bother doing. Lift your game, and put some effort in.