You can translate the question and the replies:

Time Functions

Hi I have timestamps defined as decimals which I'm trying to convert to a date/time format to do a DaysBetween calculation --select getdaysbetween(to_date(date as decimal), to_date( '26-11-2021')) date as decimal = '20220225140000600' when I try to convert with a date format the result is 'null' eg to_date('yyyyMMddHHmmss',date as decimal) Ive tried browsing the Q&A but nothing seems to work Thanks Philip
user
28-02-2022 04:26:20 -0500

1 Answer

Hi, In order to get the number of days in between 2 given dates using the getdaysbetween() when one of the inputs is in decimal form, I would use the following query in order to get the required output: > select getdaysbetween(to_localdate('yyyy-MM-dd','2022-02-23'),to_localdate('yyyyMMddHHmmssSSS',(cast('text', <decimal date>)))) The to_localdate function converts a text value containing a datetime in specific format to a value of type localdate. Since the to_date function is deprecated and may be removed in next major versions of Denodo Platform I would use the to_localdate function instead. For more information, you could refer to the [Datetime Functions](https://community.denodo.com/docs/html/browse/8.0/en/vdp/vql/functions/datetime_functions/datetime_functions) section of the Virtual DataPort VQL Guide. Hope this helps!
Denodo Team
01-03-2022 06:14:38 -0500
You must sign in to add an answer. If you do not have an account, you can register here