天软金融分析.NET函数大全 > TSL函数 > 基础函数 > 日期时间 > 日期格式的转换

DateTimeToFileDate    

简述

标准时间格式转换成文件的时间格式。
定义
DateTimeToFileDate(DateTime: TDateTime): Integer;
参数
名称类型说明
DateTime TDateTime日期时间类型
返回 Integer
整数,文件时间
  • 范例


    EndT:=strtodatetime('2014-01-01 10:00:00');
    FileEndT:=DateTimeToFileDate(EndT);
    return array(EndT,FileEndT);
    //比较两种日期输出
    //输出:array(41640.41667,1143033856)
  • 差异说明
    转化的结果依赖运行时操作系统相关API,转换结果会存在差异,但是同一系统中,转换与转回是自恰的。
    即,通过DateTimeToFileDate转换后的结果,再通过FileDateToDateTime转回,可以得到最初未转换之前的值。
    如:
    fdate:= DateTimeToFileDate(20240525.1430T);
    echo fdate; //windows下返回:1488548800 Linux中返回:1716618600
    t:= FileDateToDateTime(fdate);
    return t; //都返回20240525.1430T
相关