如何将以下转换为天数小时和分钟 [英] How to convert the below to days hours and minutes

查看:75
本文介绍了如何将以下转换为天数小时和分钟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



i我在datagridview列中的两个日期之间得到以下代码的差异,结果类似于44.00:00:00



如何将我的结果转换为44天0小时0分等等。



Hi All,

i am getting the difference between two dates in my datagridview column with the below code and the result is something like 44.00:00:00

how do i convert my result to 44 days 0 hours and 0 minutes etc.

For Each row As DataGridViewRow In IRQUEUEDataGridView.Rows

    row.Cells("Pendingsince").Value = row.Cells("Current_date").Value - row.Cells("Allocated_Date").Value

Next





我尝试了什么:



i试过以下代码

For Each A行在IRQUEUEDataGridView.Rows中的DataGridViewRow



row.Cells(Pendingsince)。Value = row.Cells(Current_date)。Value - row.Cells(Allocated_Date )。值



下一步



What I have tried:

i have tried the below code
For Each row As DataGridViewRow In IRQUEUEDataGridView.Rows

row.Cells("Pendingsince").Value = row.Cells("Current_date").Value - row.Cells("Allocated_Date").Value

Next

推荐答案

假设单元格包含DateTime值:

Assuming the cells contain DateTime values:
Dim diff as TimeSpan = row.Cells("Current_date").Value - row.Cells("Allocated_Date").Value
row.Cells("Pendingsince").Value = String.Format("{0} days {1} hours and {0] minutes", diff.Days, diff.Hours, diff.Minutes)


这篇关于如何将以下转换为天数小时和分钟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆