community
cancel
Showing results for 
Search instead for 
Did you mean: 

Alteryx designer Discussions

Find answers, ask questions, and share expertise about Alteryx Designer.

Datetime conversion using formula in-db tool

Meteoroid

Hi,

 

I want to convert string value to datetime using formula in-db tool. Below is my sample data:

 

Input                                                   Output

20180401102000 (string) ---> 2018-04-01 10:20:00

 

I know how to achieve this without in-db tool, but my requirement is to do this in in-db tool.

 

Please help.

Alteryx Certified Partner

Hi Jaichan!

 

What is the datasource (oracle, sql server, etc)? The help file is very useful for this tool https://help.alteryx.com/11.8/index.htm#cshid=LockInFormula.htm  

 

This isn't the solution but an example that might be close to what you are looking for if you were using SQL Server for example:

 

Cast('7/7/2011' as datetime)

 

and

 

Convert(varchar(30),'7/7/2011',102)

 

https://stackoverflow.com/questions/207190/sql-server-string-to-date-conversion 

 

The other option is to use the WRITE DATA IN DB tool and essentially create a lookup table. 

 

Meteoroid

Hi Joshua,

 

Thank you for response.

 

Datasource is impala.

 

I want to use this formula either in select statement in 'Connect in-db' tool or formula in-db tool in the workflow.

for ex: Select TO_DATE('column_name','MM/DD/YYYY HH:MI:SS') from table  ---> in 'connect in-db' tool.

 

 

Labels