Page 1 of 1

Fatal Error: Invalid time

Posted: Mon Jul 01, 2013 5:52 pm
by mmanes
Hi to everyone,
is there a way to check if an input is a date in a transformer stage?

tks

Posted: Mon Jul 01, 2013 8:09 pm
by chulett
IsValidDate()

Doesn't quite relate to your subject, though.

Posted: Tue Jul 02, 2013 1:10 am
by ray.wurlod
Only if the source data type is a string of some kind.

If the source data type is Date, then theoretically it can't be invalid unless it has more fractional seconds than are specified in your metadata, or is not constructed using the format specified in your metadata.

Posted: Tue Jul 02, 2013 7:42 am
by ArndW
I believe that the IsValidDate() only accepts the system default date format, if the string is different then IsValid('date',In.DateColumn,'%yyyy-%mm-%dd') would work, assuming your date format is 9999-12-31.

Posted: Tue Jul 02, 2013 7:43 am
by chulett
Or that. :wink:

Posted: Wed Jul 03, 2013 4:34 pm
by mmanes
I'm sorry,
I cannot see "premium content".

thank you anyway.

Posted: Wed Jul 03, 2013 9:25 pm
by chulett
We know. But there's plenty of information you can see, didn't any of it help? Let us know if you still have any specific questions... and I'm still wondering why your subject says "Invalid Time" and then you asked how to validate a date. Are you actually wondering how to validate a timestamp?

Posted: Thu Jul 04, 2013 9:19 am
by mmanes
Yes, but I find only "isValid()" function.

There're not other functions like IsValidDate or IsValidTimestamp.

I need to check if a string is a timestamp

thank you

Posted: Thu Jul 04, 2013 10:11 am
by chulett
What version are you on? Regardless - did you check the documentation for IsValid? It is multi-purpose as you might gather from the name:
The IsValid() documentation wrote:Returns whether the given string is valid for the given type. Valid types are "date", "decimal", "dfloat", "sfloat", "int8", "uint8", "int16", "uint16", "int32", "uint32", "int64", "uint64", "raw", "string", "time", "timestamp", "ustring".
There's more in the docs. Give that a shot.

Posted: Sat Jul 06, 2013 4:49 pm
by mmanes
My DS version is 8.1

I don't know the syntax of IsValid() to check a timestamp

I've, in a file...

NAME;YYYYMMDDHH24MISS;LOCATION

I need to check if timestamp field is a valid timestamp

tks

Posted: Sat Jul 06, 2013 9:21 pm
by chulett
The syntax is in the documentation. Does your version support an 'optional format string'? That would simplify things but from some searches here and online 8.1 might not allow that optional third parameter.