Login | |
|
 |
RE: Time/Minute problem - 8/17/2007 5:50:23 AM
|
|
 |
|
| |
CondoPC
Posts: 118
Score: 0
Joined: 7/23/2007
Status: offline
|
I think that if you review this recent post, it maygive you some ideas on how this can be accomplished: http://www.visualbasicscript.com/m.aspx?m=50876&mpage=1&key= Also, your second link to use DatePart() shoudl give you an idea on how to get the specific time back and compare it to your required timeframe. I provided an example of the process, although I didn't give the specific values because it is good to learn it on your own, you'll retain it better than if it is given to you. dteStartTime = <formatted start time> dteEndTime = <formatted end time> dteCurrTime = <code to get the time from Now()> 'compare to your span If dteCurrTime > dteStartTime AND dteCurrTime < dteEndTime Then wscript.echo "time meets required window" Else wscript.echo "time outside of window" End If
< Message edited by CondoPC -- 8/17/2007 6:02:11 AM >
|
|
| |
|
|
|
 |
RE: Time/Minute problem - 8/17/2007 9:40:27 AM
|
|
 |
|
| |
sheepz
Posts: 247
Score: 2
Joined: 3/17/2006
From: Riverside the 909s
Status: offline
|
thanks condo, i kept trying to use Minute(Now) to extract the minutes and Hour(Now)... didn't know how to go about it... but this line is exacty what i was looking for, thanks! 'n is for Minutes strTimeDiffer = DateDiff("n", TimeStamp, Now())
|
|
| |
|
|
|
 |
RE: Time/Minute problem - 8/17/2007 11:52:57 AM
|
|
 |
|
| |
sheepz
Posts: 247
Score: 2
Joined: 3/17/2006
From: Riverside the 909s
Status: offline
|
i read DateDiff() in msdn but overlooked it because the name is very misleading. i thought it only dealt with the date not the time.
|
|
| |
|
|
|
 |
RE: Time/Minute problem - 8/17/2007 4:26:56 PM
|
|
 |
|
| |
CondoPC
Posts: 118
Score: 0
Joined: 7/23/2007
Status: offline
|
sorry if this loops you back some more. I have a function that I picked up somewhere that I use to format Now() into a string that I append to a filename to make it unique. You should be able to get enough information from it to get your time stamp so that you can then compare it to you timeframe. '========================================== 'Format Date and Time '========================================== 'This will format the date and time to be used in a filename Function rDateTime() 'get 24-hour Hour and Minute and Second myHour = Left(FormatDateTime(Time, vbShortTime),2) myMinute = Right(FormatDateTime(Time, vbShortTime),2) mySecond = DatePart("s" , FormatDateTime(Time, vbLongTime)) 'concatenate the time myTime = myHour & myMinute & mySecond 'get Month and Day and Year myDayName = DatePart("D",Date) myMonthName = DatePart("M",Date) myYear = DatePart("YYYY",Date) 'concatenate the date myDay = myYear & myMonthName & myDayName 'return formatted values rDateTime = myDay & myTime End Function
|
|
| |
|
|
|
| |
|
|
 |
|
 |
|
|