跳到主要内容

如何在Excel中将毫秒转换为时间?

众所周知,一秒等于1000毫秒之间的时间单位,本文将讨论如何在Excel中将毫秒转换为hh:mm:ss时间。

使用公式将毫秒转换为hh:mm:ss时间


箭头蓝色右气泡 使用公式将毫秒转换为hh:mm:ss时间

要将毫秒转换为时间,可以使用以下公式:

请在要输出结果的空白单元格中输入以下公式:

=CONCATENATE(TEXT(INT(A2/1000)/86400,"hh:mm:ss"),".",A2-(INT(A2/1000)*1000)),然后将填充手柄向下拖动到要应用此公式的单元格,并且该单元格中的所有毫秒都已转换为时间,请参见屏幕截图:

doc将毫秒转换为时间1

最佳办公生产力工具

🤖 Kutools 人工智能助手:基于以下内容彻底改变数据分析: 智能执行   |  生成代码  |  创建自定义公式  |  分析数据并生成图表  |  调用 Kutools 函数...
热门特色: 查找、突出显示或识别重复项   |  删除空白行   |  合并列或单元格而不丢失数据   |   不使用公式进行四舍五入 ...
超级查询: 多条件VLookup    多值VLookup  |   跨多个工作表的 VLookup   |   模糊查询 ....
高级下拉列表: 快速创建下拉列表   |  依赖下拉列表   |  多选下拉列表 ....
列管理器: 添加特定数量的列  |  移动列  |  切换隐藏列的可见性状态  |  比较范围和列 ...
特色功能: 网格焦点   |  设计图   |   大方程式酒吧    工作簿和工作表管理器   |  资源库 (自动文本)   |  日期选择器   |  合并工作表   |  加密/解密单元格    按列表发送电子邮件   |  超级筛选   |   特殊过滤器 (过滤粗体/斜体/删除线...)...
前 15 个工具集12 文本 工具 (添加文本, 删除字符,...)   |   50+ 图表 类型 (甘特图,...)   |   40+ 实用 公式 (根据生日计算年龄,...)   |   19 插入 工具 (插入二维码, 从路径插入图片,...)   |   12 转化 工具 (小写金额转大写, 货币兑换,...)   |   7 合并与拆分 工具 (高级组合行, 分裂细胞,...)   |   ... 和更多

使用 Kutools for Excel 增强您的 Excel 技能,体验前所未有的效率。 Kutools for Excel 提供了 300 多种高级功能来提高生产力并节省时间。  单击此处获取您最需要的功能...

产品描述


Office Tab 为 Office 带来选项卡式界面,让您的工作更加轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,发布者,Access,Visio和Project。
  • 在同一窗口的新选项卡中而不是在新窗口中打开并创建多个文档。
  • 每天将您的工作效率提高50%,并减少数百次鼠标单击!
Comments (19)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Quando eu tento usar a formula, o Excel apresenta um erro como se eu não estivesse querendo fazer uma formula. Estou copiando exatamente a formula original do post
This comment was minimized by the moderator on the site
Hello Matheus,
Sorry to hear that. In Portugal and Spain, commas in the formula should be replaced by semicolons. So the formula should be =CONCATENATE(TEXT(INT(A2/1000)/86400;"hh:mm:ss");".";A2-(INT(A2/1000)*1000)). Please have a try. Look forward to your reply.

Sincerely,
Mandy
This comment was minimized by the moderator on the site
In Excel is easy: =(A2/1000/3600)*"01:00:00"

Set for cell B2 own format number (for 3 decimal places) : hh:mm:ss.000;@
or
Set for cell B2 own format number (for 1 decimal place) : hh:mm:ss.0;@       (Round up for one decimal place)
This comment was minimized by the moderator on the site
In Excel is easy: =(A2/1000/3600)*"01:00:00"
Set B2 format number own (for 3 decimal places) : hh:mm:ss.000;@orSet B2 format number own (for 1 decimal places) : hh:mm:ss.0;@
This comment was minimized by the moderator on the site
Hello ,How are you. I think I know now how to set the format to 3 decimal places or 1 decimal place. Just apply a custom number format to the result. Your advice really helps. Thanks!Sincerely,Mandy
This comment was minimized by the moderator on the site
Hello ,Thank you for your comment. Indeed, your formula is simplier. I enter your formula =(A2/1000/3600)*"01:00:00" into cell B2, and apply the Time format among the number formats. The result format becomes hh:mm:ss. Please see the screenshot. But I can't set the results to 3 decimal places or 1 decimal place. Any way, thank you for your advice.
This comment was minimized by the moderator on the site
Let me rephrase that last question:
"My question here is how do I right the equation so that any number of milliseconds less that 172,800,00 equals the right number of days?"

I meant to type:

My question here is how do I right the equation so that any number of milliseconds more than 172,799,999.00
equals the right number of days?
This comment was minimized by the moderator on the site
This is a very helpful discussion for me. I found Rob Bell's and Jan Hook's previous posts such a great help to the initial tutorial. I needed the additional "day" column to count out my milliseconds which were over the 84,000,000 per day. So I modified Robs easy equation to say, "=TEXT(A1/86400000,"dd:hh:mm:ss.000")." I also used Jan's second equation posted. Funny thing though, on google sheets, when I use the expression on 0ms, the result is 30:00:00:00.000, instead of 00:00:00:00.000. When I try the expression on 1ms, the result is 30:00:00:00.001, instead of 00:00:00:00.001. When I try the expression on 99999999ms, the result is 31:03:46:39.999. When I try the expression on 1111111111ms, the result is 11:20:38:31.111. Notice that all of these except the 1111111111ms begins with a "3", such as 2ms=30:00:00:00.2. It seems to me that strangely the expression "=TEXT(A1/86400000,"dd:hh:mm:ss.000"), and Jan's longer version both result in throwing off the math by exactly 30 days, until the 172,800,000ms, at which time the 30 days drops off, and the expression reports a result of 01:00:00:00.000.

My question here is how do I right the equation so that any number of milliseconds less that 172,800,00 equals the right number of days?
This comment was minimized by the moderator on the site
The simplest/ easiest expression to do this (based on Florian's post below) is =TEXT(A1/8400000,"hh:mm:ss.000")
This comment was minimized by the moderator on the site
You can get the original formula to work by modifying the millisecond portion of the formula to include the text function to format as follows: =CONCATENATE(TEXT(INT(A1/1000)/86400,"hh:mm:ss"),".",TEXT(A1-(INT(A1/1000)*1000),"000"))
If you need to allow for days you can do the following:
=CONCATENATE(TEXT(INT(A1/1000)/86400,"dd:hh:mm:ss"),".",TEXT(A1-(INT(A1/1000)*1000),"000"))
This comment was minimized by the moderator on the site
Hello Jan Hook,Thank you so much for your advice. It helps and corrects the tiny portion of mistakes in our formula. We appreciate your effort and would love to take your advice. Thanks again.Sincerely,Mandy
This comment was minimized by the moderator on the site
Thanks for this all!

=CONCATENATE(TEXT((A1/1000)/86400,"[hh]:mm:ss"))

Is what worked for me as I was looking to round up the milliseconds.

Example of 230947 ms
The original format gave: 00:03:50.947
The format I got rounds up: 00:03:51

Cheers!
This comment was minimized by the moderator on the site
But how do we change the data type into duration. This 100% converts into mm:ss but how do we convert to duration data type
This comment was minimized by the moderator on the site
this produces some errors in some cases (I've not bothered to figure out why or in what cases, but it messed up in about 10% of my rows. Instead, divide the millisecond by 86400000, for example with

=(A1/86400000)

then apply a custom number format to the new value, such as:

[hh]:mm:ss.000

..this worked fine for me in 100% of my rows.
This comment was minimized by the moderator on the site
Hello ,Thank you for your advice. And sorry for the inconvenience. WBest regards,
Mandy
This comment was minimized by the moderator on the site
There's an error in this formula. Note row 6 of the screenshot. 6604545009 should convert to 10:35:45:009. However it the formula incorrectly converts this to 10:35:45:900. 009 vs 900 milliseconds.
This comment was minimized by the moderator on the site
Hello Gautam,Thank you for your comment. You are absolutely right. And we will correct this error soon. Thanks again!Best regards,Mandy
This comment was minimized by the moderator on the site
is this true? Because 79000231 seems to me that this is shorter than 100121211012 but it is longer when you convert it to hh:mm:ss
This comment was minimized by the moderator on the site
Hello Mirjam,How are you. The reason why the shorter 79000231 converts longer results than 100121211012 is that the format dismisses the days. When the format becomes dd/hh/mm/ss, you will see what I mean. Please see the screenshot.
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations