SHARE
TWEET

Quartz.NET - change fire date to NOW

a guest Jan 22nd, 2016 59 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. DECLARE @ticksPerDay BIGINT = 864000000000 -- DO NOT CHANGE
  2. DECLARE @date DATETIME
  3. DECLARE @triggerName varchar(300)
  4.  
  5. --####### set the source date value here ########
  6. SET @date = GETUTCDATE() --put here UTC date
  7. SET @triggerName = 'triggerName'
  8. --#####################################
  9. DECLARE @date2 DATETIME2 = @date
  10. DECLARE @dateBinary BINARY (9) = cast(reverse(cast(@date2 AS BINARY (9))) AS BINARY (9))
  11. DECLARE @days BIGINT = cast(substring(@dateBinary, 1, 3) AS BIGINT)
  12. DECLARE @time BIGINT = cast(substring(@dateBinary, 4, 5) AS BIGINT)
  13. DECLARE @nextFireTime bigint = @days * @ticksPerDay + @time
  14.  
  15. SELECT @date AS [DateTime]
  16. ,@nextFireTime AS [Ticks]
  17. ,CAST((@nextFireTime) / 864000000000.0 - 693595.0 AS DATETIME) + (GETDATE() - GETUTCDATE()) as [CheckDate]  --local time (for SQL SERVER)
  18.  
  19. UPDATE QRTZ_TRIGGERS
  20. SET NEXT_FIRE_TIME = @nextFireTime
  21. WHERE TRIGGER_NAME= @triggerName
RAW Paste Data
Top