Can anyone help me?
I need to show the current time in 24hr format + 15mins, so if the time now is 23:52, it should show 00:07.
I did manage to find a code that adds 15mins onto the minutes’ section, but the problem is because it’s not added to the time as a whole, when it enters into the next hour it doesn’t update the hour.
This is what I have right now:
The issue is it’s only adding the additional 15mins to the minutes and not the hour but I need a way to add it to the entire time. I did try adding 0.25 and even 1 divided by 4 to the hour but it just showed the hour as a decimal.
Hi and welcome, @conners.uk !
Just one suggestion… I think you should use the tag #DNOW# (Current timestamp, it should indicate the number of total milliseconds of the actual time) and work on it to get minutes and hours (and day, and month… the problem should arise on these cases too). So if you divide by 60 a couple of times and you should find minutes and hours, then divide it by 24 and you should get the days… but I’ve not tested it, as soon as I can I’ll try
I think you can use this for hours:
In this logic, if minutes in hour are below 45, show current hour, if above 45 - show an hour later.
Equivalent of adding 15 minutes.
Try experimenting with #Dm#<45 or <=45 - I only had a minute to try this out. I’ll spend more time after work
That works perfect, thanks!
Do you know how to get the leading zero in the minutes? I’ve tried using DmZ but it’s not working. When the time is say “12:02” it’s showing like “12:2”. This is what I have now:
If I do this (added the Z to minutes) nothing happens:
OK, I think I’ve solved it
The reason you can’t get leading zero in minutes is because the moment you add mathematical operation on it, it becomes an integer instead of text string.
To solve this we’ll have to cheat a little
You’ll need to create three text layers:
- hours and : (e.g. “12:”);
- minutes+15 string;
- minutes displaying tenths only when below 10 minutes.
Here is a working example so feel free to use it, inspection is enabled
Here is the explanation how it works.
Layer 1: Hours
This is simple, we’ve used our previously-created string:
… and added colon at the end.
Layer 2: Minutes+15
This layer has two tasks:
- when minutes are below 10, it becomes fake “0” and does nothing else;
- when minutes are above 10, it displays them from 11 to 59.
For this, we’ll use
$((#Dm#+15)%60)<10?0:((#Dm#+15)%60)$ as a text string.
It’ll work in conjunction with Layer 3 to display minutes correctly.
Layer 3: minute tenths when below 10
This layer will use
((#Dm#+15)%60) in Text field, but we’ll also add this to Opacity field:
You’ll need to adjust text alignment as in my example face, otherwise text may start going all over the place so just pay attention to alignment settings.
To make it easy, I’ve used temporary text field with rigid “8:00” string in it, set the time to 8:00 on the Time Machine and put all elements over the temporary text layer (with alignments as in example), then just removed it the temp layer.
It was fun to try and figure it out
PS: Apologies I didn’t respond earlier, had a look same day you’ve responded but life got in the way.