简体   繁体   中英

Need to get the date part from a column and Convert the time zone from UTC to CST time zone

Need to get the date part from column Start_DateTime (varchar data type) which is having data like '06/04/19 10:44 AM CDT' , '06/10/19 11:56 AM EDT' and need to convert the time zone to CST time zone

I have a user defined function dbo.fn_UTCtoCST that will convert the time zone but am trying to combine all this in a select query to get the desired result

SELECT 
            Start_DateTime
           ,Inspector
           ,Status
           ,Distance
           ,Location
from XYZ

If your function is scalar value function(returning one value) then this might will work for you.

select * 
from A 
  cross apply dbo.fn_UTCtoCST(date)  cstdate.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM