小编Jam*_*mes的帖子

Coldfusion 计算天、小时、分钟中的秒数

我想将秒转换为天、小时和分钟 目前,它仅适用于小时和分钟,但不适用于天。你能支持我吗?告诉我我做错了什么:

<cfscript>
    seconds = '87400';
    midnight = CreateTime(0,0,0);
    time = DateAdd("s", seconds, variables.midnight);
    date= xxxxxxxxxxxxxxxxxxxxx???
</cfscript>

<cfoutput>
    #DateFormat(variables.date, 'd')#  not working 
    #TimeFormat(variables.time, 'HH:mm')#
</cfoutput>
Run Code Online (Sandbox Code Playgroud)

对于该值,87400预期结果是

  • 1 天 0 小时 16 分钟

如果我花94152几秒钟,它将是:

  • 1天3小时22分钟

我唯一的问题是获得正确的日期...显示小时和分钟,但不是正确的日期

感谢大家的支持

coldfusion date coldfusion-9

0
推荐指数
1
解决办法
484
查看次数

标签 统计

coldfusion ×1

coldfusion-9 ×1

date ×1