"Date" Data type required instead of "Text"
Application Type
Reactive
Service Studio Version
11.53.9 (Build 61018)

Error prompting 'Date'  data type required instead of 'Text' using FormatDateTime function.


Variable used is already in Date Time data type



Hi Alex,

Looks like you are assigning a date variable with the value of a datetime.

FormatDateTime is all wrong for that, as that results in a text value.

I don't agree with other advice to just slap a TextToDate on it to fix it, 2 wrongs don't make a right.

Instead, use the proper conversion function to convert a datetime to a date.

But the real question is : why on earth is a local variable representing a hired date defined as datetime, that is awfull.

Dorine

Hi Alex,

I believe you are assigning a the output of the function (which is a text) to an attribute that is defined as a Date or DateTime.

Therefore you need to assign it to Text attribute or to convert the function's output to an DateTime format.


Hope it helps!

Best Regards;


Telmo Oliveira

Hello

The issue here is that,

I assume the varible where you are assigning this expression is of Data type Date, so 

when you use FormatDateTime() function it convert the date time into text,

but in actual the variable where you are assigning this value is of data type date.

You need to convert text to date

TextToDate(FormatDateTime(DateTime,"yyyy MM dd")) likewise

I hope this helps

Thanks

Hi Alex,

This error occur when you try assign variable data type of DATE to other TEXT. So that is meaning you need parse the return TEXT value from built-in-function FormatDateTime() to DATE using the other built-in-function called TextToDate().

regards,


NOTE: THIS DOCUMENT WILL HELP YOU HOW TO SOLVE THIS PROBLEM, CLICK HERE!

Hi Alex,

Looks like you are assigning a date variable with the value of a datetime.

FormatDateTime is all wrong for that, as that results in a text value.

I don't agree with other advice to just slap a TextToDate on it to fix it, 2 wrongs don't make a right.

Instead, use the proper conversion function to convert a datetime to a date.

But the real question is : why on earth is a local variable representing a hired date defined as datetime, that is awfull.

Dorine

Hi, @Alex Lee 

The error says that your variable is of type text, change it to date time as shown in the image.

Best regards

thanks for the help guys!

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.