You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

能否在TDL(Tally定义语言)中传入毫秒级时间?及mm-dd-yyy hh:mm:ss格式日期时间转毫秒是否可行?

TDL Datetime & Milliseconds Handling: Answers to Your Questions

Great questions about working with precise timestamps in TDL! Let’s break down each one clearly:

1. Can we pass time in milliseconds in TDL?

TDL doesn’t natively support a datetime data type that includes milliseconds—most of Tally’s built-in datetime operations operate at the second level. But that’s not a dead end! A practical workaround is to split your precise timestamp into two components:

  • Store the core datetime (without milliseconds) in a standard TDL datetime field.
  • Store the milliseconds as a separate integer field.

When you need to use the full precise timestamp (for calculations or external integrations), you can combine these two values in your custom TDL logic.

2. Converting mm-dd-yyyy hh:mm:ss datetime to milliseconds in TDL?

There’s no out-of-the-box TDL function to directly convert a datetime string to a Unix timestamp (milliseconds since epoch), but you can build a custom solution using existing TDL tools:

  • Step 1: Parse the input string into a valid TDL datetime object using the $Date function. You’ll need to specify the input format to ensure Tally interprets it correctly:
    $Date:"mm-dd-yyyy hh:mm:ss" "your-input-datetime-string"
    
  • Step 2: Calculate the difference from the Unix epoch (January 1, 1970 00:00:00) using the $DateDiff function, which returns the difference in seconds.
  • Step 3: Convert to milliseconds by multiplying the second count by 1000.

Important note: Tally’s datetime handling depends on the system’s local timezone. If your use case requires UTC-based milliseconds, you’ll need to add timezone adjustment logic to account for that.


内容的提问来源于stack exchange,提问作者Rohini

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.29 20:27:45