Forum Discussion

vd484's avatar
vd484
Occasional Contributor
15 years ago

assertion for date time

Hello

Can some one help me with this please.

I have a Date time value in the response that i need to validate only for the date and ignore the time.

I added the assertion to check - exist only but i need to validate the date.

Any help would be appreciated.

Thanks
vd484
  • wdowling's avatar
    wdowling
    Occasional Contributor
    I expect that the solution will be a script assertion do you have an example of the string you'll be returned?
  • vd484's avatar
    vd484
    Occasional Contributor
    hello

    I am adding script assertions for content and below is the date format i get -
    2010-08-17T00:00:00-07:00
    I just want to validate the date and not the time by using a wild card.

    Thanks
    vd484
  • vd484's avatar
    vd484
    Occasional Contributor
    All

    figured how to do it.

    Add a script assertion for Content matching Reg Ex and use this 2010\-08\-17T.* or [0-9][0-9][0-9][0-9]\-[0-9][0-9]\-[0-9][0-9]T.*

    Thanks
    vd484