If you ever need to verify some date in the GUI is equal to current date, you will probably get something like this:
date in GUI: "08/04/2015"
current date, given by Date funtion: #8/4/2015#
cDate(date in GUI): #4/8/2015# (!month and day are switched, so you cannot compare)
The solution I found is:
publishedOn = Browser("Browser_Local").Page("Page").WebEdit("Published on").GetROProperty("Value")
dateNow = Right(String(2, "0") & Month(date), 2) & "/" & Right(String(2, "0") & Day(Date), 2) & "/" & Year(Date)
Basically Right(String(2, "0") & Month(date), 2) will give you 2 digits.
Reference:
https://jasonadamlee.wordpress.com/2011/07/21/vbscript-easy-two-digit-month-and-day/
No comments:
Post a Comment