We have a team that currently resides in the US
and Poland
. Due to time changes, the " excused
" login time is incorrect for Krakow
because some analysts start around 11 pm Poland time
, and the system picks up that they logged in at 12am
the next day US time.
This is currently what I have written:
SELECT
UPPER([UTL_REFERENCE]) as userid,
CONVERT(date, schedule. dia) as date,
schedule.dia as scheduled,
schedule.Excused
FROM
(
SELECT
MIN( HORT_DATE + CAST(cast(HORT_HEURE_DEBUT as time) as datetime)) as dia,
CONVERT(date, HORT_DATE) as the_day,
HORT_XRF_REP_SEQUENCE,
Excused =
CASE
WHEN (HORT_CODE_ACTIVITE = 13 and HORT_ID_RESTRICTION = 32) then 1 else 0
end
FROM [CWFM].[dbo].[CalHorairesxJourxPrepose] chj
where
HORT_CODE_ACTIVITE IN (4, 13,17) and
HORT_DATE > '2019-01-01 00:00:00'
group by CONVERT(date,HORT_DATE), HORT_XRF_REP_SEQUENCE,
CASE
WHEN (HORT_CODE_ACTIVITE = 13 and HORT_ID_RESTRICTION = 32) then 1
else 0
end
) schedule
inner join [CWFM].[dbo].CalPreposes cp
on cp.REP_SEQUENCE = schedule.HORT_XRF_REP_SEQUENCE
inner join [CWFM].[dbo].[CalProfilUtilisateurs] cpu
on cp.REP_SEQUENCE = cpu.[UTL_XRF_REP_SEQUENCE]
where cp.REP_ACTIF = 1
The first thing to remember is that the local-times are not mixed up:
This is a good articel for your problem:
So you need to add to every time-stamp the correct time-zone - eg:
DateTime.AddZone([Date],-12)
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.