Verify Date Format Action

Modified on Thu, 18 Apr at 5:12 PM

The 'Verify Date Format' action allows you to verify that dates displayed on a web page match a specified format. This can be useful in ensuring that dates are displayed correctly according to your requirements.



Consider an example for verifying date format on a web page.

Example Scenario The scenario describes a test to verify that the date format displayed on a web page matches the expected format for the current date. The steps involve fetching the text of the date from the web application comparing it with the format of today's date, and displaying the date in different formats based on the example scenarios provided.

Given I am on the web application where the date is displayed

When I fetch the text of the date

Then I compare the date format with today's date format

And I display the date in the following format: "%A, %b %d" for Monday, Mar 28

And I display the date in the following format: "%A, %b. %d" for Monday, Mar. 01

And I display the date in the following format: "%A, %b %-d" for Monday, Mar 1


In this scenario, the date formats are adjusted to match the DD MMYY format, where:


  • "%A, %b %d" for Monday, Mar 28: This format displays the full day of the week (Monday), followed by the abbreviated month (Mar), and the day of the month (28).

  • "%A, %b. %d" for Monday, Mar. 01: This format is similar to the first one but includes a period (.) after the abbreviated month (Mar).
    
    
  • "%A, %b %-d" for Monday, Mar 1: This format includes the full day of the week (Monday), the abbreviated month (Mar), and the day of the month (1) without leading zeros, indicated by the %-d specifier.


Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article