In my backend, I have a document type with a datetime field named "lecture time".
then I use it in the XSLT like the follwoing picutre. but it said "String was not recognized as a valid DateTime".
I think it is a datetime type and can be compared with anther datetime value. Had someone encountered it? Should I convert the lecturetime to Datetime type? How can I fix it? Thank you in advanced.
Since you're looping over a bunch of values you probably need to ensure that you only do the date-check if the date in fact has been selected. I suspect there is at least one empty value, which is why you get this error.
I assume that the "lectureTime" is setup to be of a datatype "Datepicker", right?
Jan is right - this error is 99.999% certain to be caused by an empty value in the lectureTime property (or a bogus value if the property isn't set up as a DatePicker).
You can safeguard by adding a predicate to the nodeselection, using the normalize-space() function to make sure the lectureTime has a value (and assuming it's a DatePicker it will be a valid one):
Compare datetime in XSLT
In my backend, I have a document type with a datetime field named "lecture time".
then I use it in the XSLT like the follwoing picutre. but it said "String was not recognized as a valid DateTime".
I think it is a datetime type and can be compared with anther datetime value. Had someone encountered it? Should I convert the lecturetime to Datetime type? How can I fix it? Thank you in advanced.
Hi Michael
Since you're looping over a bunch of values you probably need to ensure that you only do the date-check if the date in fact has been selected. I suspect there is at least one empty value, which is why you get this error.
I assume that the "lectureTime" is setup to be of a datatype "Datepicker", right?
/Jan
Hi Michael,
Jan is right - this error is 99.999% certain to be caused by an empty value in the lectureTime property (or a bogus value if the property isn't set up as a DatePicker).
You can safeguard by adding a predicate to the nodeselection, using the
normalize-space()
function to make sure the lectureTime has a value (and assuming it's a DatePicker it will be a valid one):/Chriztian
Thank you very much! Jan and Chriztian!
Thank you for taking out your time to anwser my question.
It's very kind of you. I'm very gald I can fix my problem.
I have checked the "lecture time" value of all of nodes, The values are all not empty.
I use the normalize-space() function Chriztian suggested, that's so brilliant. It's working. ;)
I think the form of lection time is not recognized by system. right?
Anyway, Thank you very much again, I very like this place where I can feel warm!
is working on a reply...