Adding view time to end of view name

Hi, I’ve been on a mission to add the current time of a view to the end of the views name. Turning into a mission. I get the hour but its coming out as a counted number. Not the actual hour. Any suggestions?

How far I’ve gone trying to do this :slight_smile:

Try this in a code block.

x>12?(x-12)+“PM”:x+“AM”;

It checks to see if x (input time) is greater than 12 (so 13 and up).
If x is grater than 12 then subtract 12 (14-12=2) and then add PM to the end (2PM)
If x is less than 12 then simply ad AM to the end.

You could also use string split on the overall date and input the year with a space after as the separator then get the last item from the output list.

Steven

1 Like

wonderful idea. However I couldn’t get your formula to work in the code block

Did give me an idea to do this though. Its kind of mental but its fun and works :slight_smile: I’m not sure how to extract the sun settings from a listed view. Appears you can only get it from a current view.

Maybe it’s the quotes if you did a direct copy and past?

It’s working for me. Made a quick change to deal with the 12s

1 Like

Thanks man that works