Hi ,
I want to check given date is in correct format or not.
i.e date should be in YYYY-MM-DD format.
someone please help me to resolve this.
Thank you in advance.
Regards,
Suraj
Hi ,
I want to check given date is in correct format or not.
i.e date should be in YYYY-MM-DD format.
someone please help me to resolve this.
Thank you in advance.
Regards,
Suraj
Hi,
DateTime.TryParseExact(dateAsString, “yyyy-MM-dd”, Nothing, Nothing , resultAsDate) will return a boolean and the potentially converted dateTime. True if format matches → False if not.
Note that the method takes iFormatProvider and DateTimeStyles as arguments which I just gave ‘Nothing’ in this test.
You can research more:
br,
Topi
Thank you for the response.
I also got one method DateTime.TryParse(“2018-12-31”,InputDate).ToString
2018-12-31 → format in which you expect the date
InputDate → input date
Yes but TryParse will accept any format, e.g. “31.12.2018”. According to your initial requirements this should not be accepted.
TryParse(inputString, outputDate)
Hii @Topi
what is result as date ?
and that variable contains
It is a DateTime (variable type) equivalent of the given date string if the conversion was successful.
variable that
stores result?