mercredi 28 octobre 2015

How do I get a date in MMM, YYYY format using C#

I am writing a selenium automated test where I have to verify that the dates on the x-axis of the graph (shown) are correct. These dates change based on a drop down we have in the web application. (Ignore the arrow :))

enter image description here

I'm trying to generate the date in the MMM, YYYY format and compare it with the date elements in the graph

I have the following code so far:

 string circleDate2 = date.Month.ToString("MMM") + ", " + date.Year.ToString("YYYY");

however this just outputs MMM, YYYY on the console.

How do I generate the date in MMM, YYYY format and then add or subtract another month so I can verify all the date elements on the page?

Aucun commentaire:

Enregistrer un commentaire