Question

Is there any way to calculate leap year in Tosca?

  • 15 April 2024
  • 1 reply
  • 19 views

Badge

I want to verify if the year is leap year in Tosca to do some further validations , can anyone please help


1 reply

Userlevel 3
Badge +1

Easiest way is probably to use a Powershell command to determine whether the year is a leap year. You can use TBox Start Program to run the command and output the result to the clipboard, and then you can buffer it from the clipboard.

There are several knowledge base articles on the Tricentis support site with examples of how to use Powershell commands like this in Tosca (and there should be some previous posts on this forum as well).

From a quick Google search it looks like the command itself is very simple (and just returns “True” or “False”):
[datetime]::IsLeapYear(2024)

Reply