Adding/Subtracting Time

Adding/Subtracting Time

Question:
How do I add/subtract a series of time values of format hh:mm:ss (for example, 02:45:32 + 00:35:43 + and so on)?

Also, how do I set the mm:ss format?

Answer:
You can use the RelativeTime function to add and subtract seconds from a time variable. To add minutes and hours, you need to use the minutes and hour function to extract the value and multiply it up to be a seconds value.

To convert a time variable into a string time in the format mm:ss, use the second form of the string function that allows you to specify an edit mask:

ls_Time = String( Now(), 'mm:ss' )

But what if the time goes past midnight?

To solve this problem, calculate the number of seconds betweenthe old time and midnight and then see whether this number of seconds is greaterthan the number of seconds you want to add to your time.

If it is, use the RelativeDate function to add a day to the date and then subtractthe number of seconds between the old time and midnight from the number of seconds you want to add, and then add those number of seconds to midnight.

If you need to work for more than 24 hours, put this in aloop until you have reduced the number of seconds to a number small enough not to roll past midnight.

Share the Post:
Heading photo, Metadata.

What is Metadata?

What is metadata? Well, It’s an odd concept to wrap your head around. Metadata is essentially the secondary layer of data that tracks details about the “regular” data. The regular

XDR solutions

The Benefits of Using XDR Solutions

Cybercriminals constantly adapt their strategies, developing newer, more powerful, and intelligent ways to attack your network. Since security professionals must innovate as well, more conventional endpoint detection solutions have evolved

AI is revolutionizing fraud detection

How AI is Revolutionizing Fraud Detection

Artificial intelligence – commonly known as AI – means a form of technology with multiple uses. As a result, it has become extremely valuable to a number of businesses across

AI innovation

Companies Leading AI Innovation in 2023

Artificial intelligence (AI) has been transforming industries and revolutionizing business operations. AI’s potential to enhance efficiency and productivity has become crucial to many businesses. As we move into 2023, several

data fivetran pricing

Fivetran Pricing Explained

One of the biggest trends of the 21st century is the massive surge in analytics. Analytics is the process of utilizing data to drive future decision-making. With so much of

kubernetes logging

Kubernetes Logging: What You Need to Know

Kubernetes from Google is one of the most popular open-source and free container management solutions made to make managing and deploying applications easier. It has a solid architecture that makes