FAQ > 金融建模 > 数据提取 > 行情数据

Q:如何将半秒线行情数据的时间戳显示出毫秒?    

  • A:普通的datetimetostr只能显示时间点到秒,若需要显示毫秒,需要调用FormatDateTime进行自定义格式的转换。
    范例:

    setsysparam(pn_cycle(),cy_halfs());
    return select *,FormatDateTime('yyyy-mm-dd hh:nn:ss:zzz',['date']) as 'date' 
    from markettable 
    datekey 20191223T to 20191223.15T of 'IF00' end;

    返回:
    StockIDStockNamedatepriceopenclosehighlowvolamount
    IF00300期货主力合约2019-12-23 09:30:00:0004,030.804,031.004,030.804,033.604,030.80196.00237,035,160.00
    IF00300期货主力合约2019-12-23 09:30:00:5004,031.604,031.604,031.604,031.604,030.4041.0049,589,280.00
    IF00300期货主力合约2019-12-23 09:30:01:0004,030.204,030.204,030.204,030.204,030.2023.0027,817,200.00
    IF00300期货主力合约2019-12-23 09:30:01:5004,031.804,031.804,031.804,031.804,031.8031.0037,489,560.00
    IF00300期货主力合约2019-12-23 09:30:02:0004,031.604,031.604,031.604,031.604,031.6025.0030,235,920.00
    IF00300期货主力合约2019-12-23 09:30:02:5004,031.004,031.004,031.004,031.004,031.0014.0016,930,080.00
    IF00300期货主力合约2019-12-23 09:30:03:0004,031.004,031.004,031.004,031.004,031.009.0010,884,840.00
    IF00300期货主力合约2019-12-23 09:30:03:5004,030.804,030.804,030.804,030.804,030.806.007,256,100.00
    IF00300期货主力合约2019-12-23 09:30:04:0004,031.604,031.604,031.604,031.604,031.6014.0016,930,620.00
    IF00300期货主力合约2019-12-23 09:30:04:5004,031.004,031.004,031.004,031.004,031.0034.0041,112,480.00
    IF00300期货主力合约2019-12-23 09:30:05:0004,029.804,029.804,029.804,029.804,029.8042.0050,785,320.00
    IF00300期货主力合约2019-12-23 09:30:05:5004,029.804,029.804,029.804,029.804,029.6023.0027,807,660.00
    IF00300期货主力合约2019-12-23 09:30:06:0004,029.604,029.604,029.604,029.604,029.2017.0020,551,440.00
    IF00300期货主力合约2019-12-23 09:30:06:5004,029.804,029.804,029.804,029.804,029.805.006,044,280.00
    IF00300期货主力合约2019-12-23 09:30:07:0004,029.604,029.604,029.604,029.604,029.6013.0015,715,260.00
    IF00300期货主力合约2019-12-23 09:30:07:5004,029.604,029.604,029.604,029.604,029.0013.0015,715,260.00