Sum of current time

If the current time is 10:48 then output must be 1+0+4+8=13

Hi @Ajith_Kumar,

Try the below code

var1 = "10:48".Replace(":",string.Empty)
result = var1.Select(Function(x) CInt(x.ToString())).Sum()

Hi,

If your data is string type, the following will work.

strData = "10:48" or strData = now.toString("HHmm")
sum = strData.Replace(":","").Sum(function(c) CInt(c.ToString))

Regards,

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.