|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
setting date variable with hours and mins
hello
sorry a bit of a newbie question but i dont have a book and ive searched online. basically i have 2 variables representing hours and minutes and i want to make a date variable to represent the time using these 2 variables ie hours=16 mins=43 myTime =16:43 then i want to format system time to the same format so i can make an equals expression, ie if myTime is equal to systemTime then do an event. ive tried using vbShortTime and Hh,Nn but i cant figure out the syntax thanks in anticipation |
|
#2
|
|||
|
|||
|
I think u will use format function to join 2 variables to 1 date format variable.U can find this function on MSDN..But it's a easy way that get the system time to a date variable by using now() function at first,and use some string operation function get split this date variable to 2 string variable,at the last compare these string and your define time string..
|
|
#3
|
|||
|
|||
|
Code:
myString = Str(cmbHour) + ":" + Str(cmbMin) myDate = CDate(myString) thanks, i got it working with CDate and realisied vb allows u to compare 2 dates without any additional formatting thanks |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > setting date variable with hours and mins |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|