Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 23rd, 2003, 02:15 PM
rix rix is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 26 rix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
  #2  
Old December 24th, 2003, 12:17 AM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
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..

Reply With Quote
  #3  
Old December 27th, 2003, 06:54 AM
rix rix is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Nov 2003
Posts: 26 rix User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > setting date variable with hours and mins


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway