I need to send the Time as Hours and Mins ie 17:25.
Needs to be the current time plus 30 mins.
Dammed if I can work out how to do it
Some help would be appreciated
Time
Moderators: Dorian (MJT support), JRL
-
- Newbie
- Posts: 5
- Joined: Sat Dec 27, 2003 3:45 am
Time
Ross of Christchurch New Zealand
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
Here is something you may be able to use. I did this for someone else with a siimilar request some months ago. I have a variable Advance that can be changed. Advance is the amount of time in minutes that you want to add. Controls had to be included to go to the next hour and possibly to the next day. This uses a 12 hour AM/PM presentation.
Just run the macro and it will show the current system time and the time increased by the Advance variable.
Just run the macro and it will show the current system time and the time increased by the Advance variable.
If you cut/paste be sure to remove all Trailing Spaces using the Editor, Edit, Remove Trailing Spaces tool.Let>Advance=30
Hour>Hours
If>%Hours%Hours=%Hours%-12
Label>NextTime
Min>Minutes
Sec>Seconds
//Determine AM or PM, look for space character in current time.
GetTime>Now
Position> ,%Now%,1,Space
MidStr>%Now%,%Space%,3,AMPM
Let>Now=%Hours%:%Minutes%:%Seconds%%AMPM%
Label>AdvanceTime
//Need to modify this area if Advance>60
Let>Minutes=%Minutes%+%Advance%
If>%Minutes%Minutes=%Minutes%-60
//Check for leading 0 in minutes string
Len>%Minutes%,LM
If>%LM%=2,AddHour
//Comment out the next line to stop leading "0" on the minutes.
Let>Minutes=0%Minutes%
Label>AddHour
Let>Hours=%Hours%+1
If>%Hours%ChangeAMPM
Let>Hours=%Hours%-12
If>%AMPM%=AM,MakePM
Label>MakeAM
Let>AMPM=AM
Goto>End
Label>MakePM
Let>AMPM=PM
Label>End
//Check for leading 0 in hours string
Len>%Hours%,LH
If>%LH%=2,Finish
//Comment out the next line to stop leading "0" on the hours.
//Let>Hours=0%Hours%
Label>Finish
Let>Later=%Hours%:%Minutes%:%Seconds%%AMPM%
MessageModal>Time now is %Now%%CRLF%Time later is %Later%
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!
Bob
A humble man and PROUD of it!
display current time + 30 minutes using VBScript
This is another way to do it. This should output hh:mm for 30 minutes in the future.
[code]
VBStart
VBEnd
VBEval>DateAdd("n",30,now()),result
VBEval>FormatDateTime("%result%",4),result1
MessageModal>result1
[/code]
[code]
VBStart
VBEnd
VBEval>DateAdd("n",30,now()),result
VBEval>FormatDateTime("%result%",4),result1
MessageModal>result1
[/code]