Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

How to enter datetime in Excel Data Source

paolabs
paolabs Posts: 16

I am using an excel data source to import data to generate complex structures, I have managed to work with creating relationships between the different sheets, but the one thing that I can't figure out how to do is how to enter dates so that I don't get an invalid datetime error.

Anyone has done this and knows the correct format?

Comments

  • benken_parasoft
    benken_parasoft Posts: 1,302 ✭✭✭

    Can you please be specific about what error you are seeing? What is the message, exactly? Do you see it when configuring the data source or when running your test suite? Do you see the error in the Console view or the Quality Tasks view? If in the Quality Tasks view, is there detail if you double click the error? Is the error reported from a particular test? If so, how is that test configured to use the data source?

  • paolabs
    paolabs Posts: 16

    I see the error in the Quality Tasks view. When I click on it, this is the detail that I see, and I get something similar wherever I have dates.

    Not sure what you mean about how the test is configured to use the data source

    Error Message:
    DataSource: HotelDS (row 1): Value "1/1/17" from the "Taxes:Start" column is not a valid dateTime.

    Additional Details:
    Source: HotelDS (row 1)

  • [Deleted User]
    [Deleted User] Posts: 0 admin

    Hi paolabs,

    It sounds to me like your dateTime format does not adhere to the expected structure. Are you using a WSDL to set your schema? If so, I would use one of the dateTime formats here.

    <start>yyyy-MM-dd</start>

    Hope this helps!

  • benken_parasoft
    benken_parasoft Posts: 1,302 ✭✭✭

    Not sure what you mean about how the test is configured to use the data source

    Based on the error message you provided, you must be configuring a dateTime field in the Form Input view against the "Taxes:Start" column. "1/1/17" is not in the correct format for dateTime as defined by XML Schema specifications. It must include both a date and a time component and be formatted correctly. From https://www.w3.org/TR/xmlschema-2/#dateTime :

    dateTime consists of finite-length sequences of characters of the form: '-'? yyyy '-' mm '-' dd 'T' hh ':' mm ':' ss ('.' s+)? (zzzzzz)

  • paolabs
    paolabs Posts: 16

    Yes, I was initially entering the date as YYYY-MM-DD but that was not enough, I had to enter this as an example for it to work: 2018-08-16T17:37:09.911Z