delphi 获得时间戳 毫秒数

function DateTimeToMilliseconds(const ADateTime: TDateTime): Int64; //获得毫秒
var
LTimeStamp: TTimeStamp;
begin
LTimeStamp := DateTimeToTimeStamp(ADateTime);
Result := LTimeStamp.Date;
Result := (Result * MSecsPerDay) + LTimeStamp.Time;
end;

时间: 2024-08-05 19:37:37

delphi 获得时间戳 毫秒数的相关文章

用js将从后台得到的时间戳(毫秒数)转换为想要的日期格式

得到后台从数据库中拿到的数据我们希望格式是: 2016年10月25日 17时37分30秒 或者 2016/10/25 17:37:30 然而我们前台得到的却是一段数字(时间戳,毫秒数): 1477386005 时间戳转化,核心方法 : 1477386005是从后台得到时间戳 (注意:有的时候得到的时间戳是已经乘以1000的) var unixTimestamp = new Date( 1477386005*1000 ) ; commonTime = unixTimestamp.toLocaleS

ios 时间和毫秒数转换

01-时间和毫秒数的相互转换 //获取毫秒数的时间戳 long inter = [[NSDate date] timeIntervalSince1970]*1000; NSLog(@"%ld",inter); //把毫秒数转换成时间 NSDate *date = [NSDate dateWithTimeIntervalSince1970:inter/1000]; NSLog(@"%@",date);

PHP获得毫秒数

因为前端需要写函数处理时间戳,比较麻烦,所以我们有的时候,需要接口传递毫秒数给前端. 下面可以通过这个函数来获得毫秒数 1 <?php 2 function getMillisecond() { 3 list($microsecond , $time) = explode(' ', microtime()); //' '中间是一个空格 4 return (float)sprintf('%.0f',(floatval($microsecond)+floatval($time))*1000); 5

[MYSQL]时间毫秒数转换

java中常用bigint字段保存时间,通常将时间保存为一大串数字,每次取出需要在程序里转换,有时候程序里不方便,可以使用MYSQL自带的函数FROM_UNIXTIME(unix_timestamp,format). 举例: select FROM_UNIXTIME(1364176514656/1000,'%Y-%m-%d %h:%i:%s') as date ; 结果为: 2013-03-25 09:55:15 FROM_UNIXTIME(unix_timestamp,format) 其中un

把当前时间转换为毫秒数

//获取当前时间的毫秒数 public int ConvertDateTimeInt(System.DateTime time) { System.DateTime startTime = TimeZone.CurrentTimeZone.ToLocalTime(new System.DateTime(1970, 1, 1)); return (int)(time - startTime).TotalSeconds; }

js中的时间与毫秒数互相转换

[1]js毫秒时间转换成日期时间 var oldTime = (new Date("2012/12/25 20:11:11")).getTime(); //得到毫秒数 //不是上面格式的时间需要转换 //starttime ='2012-12-25 20:17:24'; starttime = starttime.replace(new RegExp("-","gm"),"/"); var starttimeHaoMiao =

js时间与毫秒数互相转换(转)

[1]js毫秒时间转换成日期时间 var oldTime = (new Date("2017/04/25 19:44:11")).getTime(); //得到毫秒数 //不是上面格式的时间需要转换 //starttime ='2017-04-25 19:44:24'; starttime = starttime.replace(new RegExp("-","gm"),"/");   //使用该 RegExp 对象在一个字符

毫秒数转成日期 得到天数

DateFormat formatter = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); long now = System.currentTimeMillis(); Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(now); System.out.println(now + " = " + formatter.format(cal

将json格式日期(毫秒数)转成日常日期格式和日常格式时间对比

第一:是把生成的Json格式的时间转换,注意要看清楚时间的格式 function (cellval) { var date = new Date(parseInt(cellval.replace("/Date(", "").replace(")/", ""), 10)); var month = date.getMonth() + 1 < 10 ? "0" + (date.getMonth() + 1