I have a table in the sql server database that has the following DataHora field where
I have data included in this format:
DataHora
2015-04-20 17:43:04.000
This time is not in the format of our time zone.
I need to make a query that in the result shows me the result Converted to our time zone
I have the following query:
select Serial,
Latitude,
Longitude,
DataHora as DataHora
from [CheckPoint] where DataHora between SWITCHOFFSET (CONVERT(datetimeoffset, '2015-04-22 10:00'),'-03:00')and SWITCHOFFSET (CONVERT(datetimeoffset, '2015-04-22 11:00'),'-03:00')
and serial='113394' order by DataHora
Would there be any easier way to get this converted data? in my query I am passing a certain date and is converting to the indicated spindle ie what I type The time is now -3. so I will not get concrete data from the time indicated.
Doubt: I need to get this formatted data to our timezone, because the dates that will be passed by parameters are in local time zone.