Forum

Please note that you can subscribe to the individual forums. A subscription for news only covers the news.

Subtracting time va...
 
Notifications
Clear all

Subtracting time variable

2 Posts
2 Users
0 Likes
1,210 Views
0
Topic starter

Hi Everyone... I'm trying to figure out how to subtract a time variable. I'm simply looking to subtract a number of hours to determine a bedtime but it just doesn't seem to work. Also, is there a way to not include seconds when having to answer the question or getting a response? 

 

[report-test time variable subtraction]
inputTime!=!waketime,What time will you need to wake up by?
subtract!=!waketime,08:00
message=Be in bed by {!waketime}. 

Does anyone know of a way that if I say I need to be up by 6 am it would calculate and display !waketime as 10 pm? 

Thanks for any help in advance!

Chazz

2 Answers
0

Hi Chazz

When you are crossing midnight in a subtraction, you need to have a date part of the time variable. You can simply add the current date. Because you don't use the date part, it doesn't matter which date it is.

{!waketime,t} will show the time of day and ignore the date. I am not sure, but I think it will use am/pm instead of the 24 hour clock if the users computer is set up to that time format.

I don't think you can avoid the seconds.

[report-test time variable subtraction]
inputTime!=!waketime,What time will you need to wake up by?
; add the date
add!=!waketime,!zzdate
subtract!=!waketime,08:00
; Show the time part only
message=Be in bed by {!waketime,t}.

Sven

 

0
Topic starter

Excellent!! Thanks so much for all you do Sven!!