`

function to convert ticks to DatetimeOffset

 
阅读更多
--function to convert ticks to DatetimeOffset
if  object_id(N'GetTimeFromTicks', N'FN') is null
begin
execute dbo.sp_executesql @statement = N'
CREATE FUNCTION dbo.GetTimeFromTicks(@Ticks BIGINT)
RETURNS DATETIME
AS
BEGIN
DECLARE @Days BIGINT
DECLARE @DaysBefore1753 BIGINT
DECLARE @TimeTicks BIGINT
DECLARE @Seconds BIGINT
 
SET @Days = @Ticks / CONVERT(BIGINT,864000000000)
SET @DaysBefore1753 = CONVERT(BIGINT,639905)
SET @TimeTicks = @Ticks % CONVERT(BIGINT,864000000000)
SET @Seconds = @TimeTicks / CONVERT(BIGINT,10000000)
 
RETURN ToDateTimeOffSet(DATEADD(s,@Seconds,DATEADD(d,@Days - @DaysBefore1753,CONVERT(DATETIME,''1/1/1753''))), ''+00:00'')
END'
 
end

 

分享到:
评论

相关推荐

    Ticks 指标 - MetaTrader 5脚本.zip

    《MetaTrader 5中的Ticks指标及其脚本解析》 MetaTrader 5(MT5)是一款全球广泛使用的外汇交易和分析平台,它为交易者提供了丰富的技术分析工具和自动化交易功能。"Ticks 指标 - MetaTrader 5脚本.zip" 是一个与MT...

    C#中datetime到Ticks的转换小程序

    之前写的一个很简陋的DateTime到Ticks相互转换的小工具。

    Ticks_Volume 指标 - MetaTrader 5脚本.zip

    这个压缩包“Ticks_Volume 指标 - MetaTrader 5脚本.zip”显然是为了在MT5平台上添加一个自定义指标,帮助用户更好地理解市场动态,特别是通过订单交易量进行分析。 `ticks_volume_indicator.mq5` 是这个压缩包中的...

    Unix Timestamps Array to Matlab DateNum Array:Convert Unix Timestamps (Ticks) to Matlab timestamps(DateNum)-matlab开发

    基于参考http://www.mathworks.com/matlabcentral/newsreader/view_thread/93932 datenum([1970 1 1 0 0 unix_time])

    Python库 | ticks-0.1.3.tar.gz

    在本文中,我们将深入探讨名为“ticks-0.1.3”的Python库,该库已压缩为ticks-0.1.3.tar.gz文件。 首先,让我们了解一下这个库的名称“ticks”。在金融和数据分析领域,"ticks"通常指的是市场交易中的最小价格变动...

    09-task-delay.rar

    这里,`pdMS_TO_TICKS()`是一个宏,用于将毫秒转换为ticks,确保了延时时间的正确计算。 接着,我们讨论绝对延迟(Absolute Delay)。绝对延迟是指任务在指定的时间点开始执行,而不是在当前时间的基础上等待。...

    php的declare控制符和ticks教程(附示例)

    其中ticks指令的使用需要配合register_tick_function()函数来实现,而encoding指令用于设置脚本的默认字符编码。 在PHP的执行流程中,一个tick事件是指脚本每执行一定数量的低级语句时触发的事件。低级语句是指在...

    Exp_Ergodic_Ticks_Volume_Indicator - MetaTrader 5EA.zip

    《MetaTrader 5 EA:基于Ergodic Ticks Volume Indicator的智能交易系统》 MetaTrader 5(MT5)是一款广泛应用于外汇、期货和股票市场的交易平台,它为交易者提供了丰富的技术分析工具和自动化交易功能。本文将深入...

    Ergodic_Ticks_Volume_OSMA_HTF - MetaTrader 5脚本.zip

    《MetaTrader 5脚本深度解析:Ergodic Ticks Volume OSMA 高频交易框架》 MetaTrader 5(MT5)是一款广泛应用于外汇、期货及股票市场的交易平台,其强大的编程语言MQL5允许用户自定义技术指标和交易策略。在给定的...

    Exp_Ergodic_Ticks_Volume_OSMA - MetaTrader 5EA.zip

    《MetaTrader 5 EA:基于Ergodic_Ticks_Volume_OSMA振荡器的交易策略》 MetaTrader 5(MT5)是一个广泛使用的外汇交易平台,它为交易者提供了丰富的功能,包括自动化交易策略(Expert Advisor,简称EA)。在本文中...

    Ergodic_Ticks_Volume_Indicator_HTF - MetaTrader 5脚本.zip

    《MetaTrader 5中的Ergodic Ticks Volume Indicator与多时间框架分析》 在金融交易领域,技术分析是投资者常用的一种决策工具,其中指标的运用至关重要。MetaTrader 5(MT5)作为一款广泛使用的交易平台,提供了...

    Ergodic_Ticks_Volume 指标 - MetaTrader 5脚本.zip

    William Blau 的多重EMA订单交易量指标之一.

    Ergodic Ticks Volume Indicator - MetaTrader 4脚本.zip

    Ergodic Ticks Volume Indicator(动态交易量指标)是一款专为MetaTrader 4(MT4)交易平台设计的技术分析工具。MetaTrader 4是一款流行的外汇、期货和其他金融衍生品交易的软件,它提供了丰富的图表和自定义指标...

    format_ticks.zip_The Handle_format_ticks

    The code replaces or appends XTickLabels and YTickLabels of axis handle h with input tickx and ticky array in MATLAB

    get_000001_day_ticks.py

    get_000001_day_ticks.py

    TimeTicks时间双向转换工具-下载

    在IT领域,时间戳(Timestamp)和Time Ticks(或称为Tick Count)是两种常见的用于表示时间的方式。它们在各种操作系统、编程语言和应用程序中都有着广泛的应用。了解这两种时间表示方式以及它们之间的转换是非常...

    qemu-0.13.0(编译过全处理器支持)

    -chardev socket,id=id[,host=host],port=host[,to=to][,ipv4][,ipv6][,nodelay] [,server][,nowait][,telnet][,mux=on|off] (tcp) -chardev socket,id=id,path=path[,server][,nowait][,telnet],[mux=on|off] ...

    网页制作完全手册

    DHTML provides everything you need to generate animated effects without resorting to custom controls. For example, consider the following script, which is a replacement for the Path control. SHOW...

    Financial econometric analysis at ultra-high frequency

    purge the data from “wrong” ticks is likely to shorten the financial durations between substantial price movements and to alter the autocorrelation profile of the series. The estimated coefficients ...

Global site tag (gtag.js) - Google Analytics