Countdown from current time, schedule - ios

I want to have a countdown from the current time to a specific schedule like this:
8:48, 9:29, 11:56, 12:36, 13:18, and ect. and display that value in a label.
For example. Now we have 11:00 o'clock. And UILabel tell us 56 minutes remaining. And after 11:56 it tell us 40 minutes remaining (from current 11:56 to 12:36).
I don't ask you code directly, just help to find right way to search.
Thanks.

some links by searching google
Implementing a Countdown Timer in Objective-c?
http://looksok.wordpress.com/2012/12/29/ios-timer-countdown-implementation-tutorial-including-source-code/
and implementation
https://github.com/jonhernandez/iOS-Timer-Countdown
I havent looked at code quality, but it should get you started

Related

Google sheets convert Decimal(0-100) to minutes(0-60)

I have a spreadsheet that receives data from an RPA, this data is HH:MM, the output is based on how long a task has taken to perform.
example:
Project
Time
Task 1
2:35
Task 2
3:45
Where 2:35 is equal to 2 hours and 35 minutes.
The issue that i am having is that when I add these numbers google sheets displays it as 5:80, where it should be 6:20, as that is the actual amount of hours and minutes represented in the table. In other words I would like the decimal counter to stop at 60 and add new, not at a 100?
Anybody have an idea of how to achieve this? :)
-- Toby
In order for the duration formatting to work the delimeter must be the correct standard according to the language you are working in.

How do I add duration to a time in Google Sheets?

I've found a few answers to questions similar to this elsewhere, except with adding or subtracting two times to get a duration, however, I haven't been able to figure it out enough to meet what I want.
I'm trying to get the time that I woke up using the time that I went to bed and the duration. I've tried doing [Time] + [Duration], however when I do that I get a value like 10060:25:00. I've also tried adding the hour value of the duration and the hour value of the time and dividing by 24, but that didn't work either. I did figure out the minutes though, all I did was =MOD([Time minute value]+[Duration minute value],60).
So to clarify, I just need to find the hour value now.
I am not exactly sure if this answers your question, but I think it is very similar. And I apologise in advance for an unnecessarily complicated description.
Sorry I didn't have time to provide a shorter answer.
I wanted to create a run sheet for a workshop with session durations.
I have a start time, and each session has a duration. I can then calculate start time for next session and cumulative duration of the sessions.
column label :> A || B || C || D
Heading label:> start_time || duration || hidden_duration || Elapsed
Number format:> date/time || number || duration ||duration
new start_time=previous_start_time+hidden_duration
hidden_duration=if(isblank(duration),"0:00:00","0:"&duration)
It seems time is particular about how it interprets a number. This is where the duration format fits in, as it formats correctly to add to time. However, a field formatted as a "duration number format", must then be entered as a duration. In other words, it is expected as 00:00:00.000 which is very particular. Or in fact, it appeared it at least needed 00:00 i.e. Hours and minutes separated by colon.
As I only had minutes, I didn't want to have to enter in this particular format all the time; and if I was to put 5 in the duration field, it was being interpreted as 5 milliseconds (or something). So I have used a simple number in the duration field and inserted it into a string in the hidden_duration field to form 0:duration. For example to add 5 into the minutes column of the hidden_duration entry it would be "0:"&5. The if(isblank(),...test was necessary to avoid blank durations voiding all the way down the column. i.e. If duration was blank, add 00:00:00 time to the start_time.
Start_time Duration Hidden_duration Elapsed
08:30:00 15 =if(isblank(B2),"0:00:00","0:"&B2&":00") =C2
=A2+C2 5 =if(isblank(B3),"0:00:00","0:"&B3&":00") =D2+C3
Drag the second row down to repeat however many entries you will have.
Don't forget to make the appropriate columns the correct number formats.
Also, you can modify the duration formats using Format | Number | More formats| Custom Number Formats and removing the unwanted display fields (such as seconds).
Then, I also made some conditional formatting rules, so that if a duration was blank, the Elapsed and time cells were white text on white background so they looked blank.
For your application you could do the same but have separate hours and minutes columns to make for easy data entry, both being used in the "hidden_duration" formula.
I hope I have helped here, as I found your question, trying to do the same and Googling an answer, but then ended up experimenting and discovering some new things myself.
Someone more knowledgable may be able to correct my entry or make more efficient. {Or at least explain more efficiently (; }
=HOUR(B2-A2)+(MINUTE(B2-A2)/60)
Basically, being B2 the end time and A2 the start time, you subtract B2-A2 and get the hour from the subtraction. Then you do the same and get the amount of minutes. After you have both, you sum the amount of hours with the amount of minutes divided by 60 (to get it in hours).
Don't forget to use the 24-hour format (i.e. 10:00 or 22:00).

Is there a way to remove +/- from CLKRelativeDateTextProvider with offset style?

I'm using CLKRelativeDateTextProvider to provide a timer on my watch complication. It's a count down. All works great except for watchOS showing a negative sign. For example (depending whether it counts up or down):
- 21 minutes
+ 21 minutes
Is there a way to somehow format the text in the CLKRelativeDateTextProvider such that it only would show 21 minutes? I couldn't find anything in the docs and online but maybe (i.e. hoping) I'm missing something.

Is there a way to get a constant update of the server time from Firebase?

My goal is for the app's viewController to do something when it reaches 6:00 pm server time. The problem is that if I use the generic code:
let timestamp = FIRServerValue.timestamp(),
Then it only gets called once, and I can't see the data updated to check against 6:00. Any solutions or workarounds would be very helpful. Thank you in advance.
Once you get the timestamp, compare it to the difference of your current computer. So for instance if you get it at it's 4:01 but your current computer is 4:00 then you know you have +1 minutes.
Then just wait for 6:00 - difference, in this case 1 minute and your server time will read 5:59 but firebase will be +1 therefore it will be 6:00.

Find the difference between a Time and 11 am on that day

I have an ActiveSuppport::TimeWithZone object and I want to find out how many minutes after 11 AM on that day it is. So, for example, if the time is 11:47 AM, I want the answer to be 47.
Is there a way in Ruby/Rails to do this.
Thanks!
Subtracting one Time object from another gives the difference in seconds. Just divide by 60 to get minutes.
(mytime - Time.parse('11 AM')) / 60

Resources