vb.net - convert numeric up down value to time format -
i have 1 numericupdown1 control if select 5 in numeric down control.the calling value this:
numericupdown1.value
that return value 5 integer instead of getting 5. want value in time format if select 5
.that should return 00:05:00
.. how can convert numeric down value times.. in data base want store value data type time(7).i tryed this:
dim value timespan = convert.todecimal(numericupdown1.value)
but getting error
you using timespan
wrongly, better rely on date
:
dim value date = new date(now.year, now.month, now.day, 0, numericupdown1.value, 0)
you can convert variable string format want doing:
dim valueasstring string = value.tostring("hh:mm:ss")
this right way use timespan
:
dim value timespan = new timespan(0, numericupdown1.value, 0)
but recommend date
alternative above. use timespan
measuring intervals (between date
type variables) , better store date/time-related information date
, easier deal with.
Comments
Post a Comment