Alteryx Designer

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

DateTime Parse not giving desired format

Highlighted
7 - Meteor

Hello,

 

I am trying to convert a date time field to be a certain format MM/dd/yyyy %I %p. It pulls as a date/time field but then I convert it to a string to get the format and then back to a date/time but when I do that and I put in the format that matches the incoming field and it formats it as yyyy-mm-dd hh:mm:ss

 

Any ideas on what I am doing wrong? It worked for several other date/time fields I have! 

 

Highlighted
9 - Comet

https://help.alteryx.com/2018.2/DateTime.htm 

 

I'm pretty sure that the Date/Time format only holds yyyy-mm-dd hh:mm:ss and won't include an AM or PM at the end so you will need to keep it as a string. 

Highlighted
7 - Meteor

that is what I am afraid of but I need to a greater than with the two dates and it doesn't seem to be working if they are strings. Is there another way??

Highlighted
9 - Comet

Why not just convert every date field to yyyy-mm-dd hh:mm:ss and then use that to compare?

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner
Agree with the poster above.

Just convert it to a real Alteryx date time using your first formula.

Then perform any manipulation using this.

Then at the end, if you need to change the formatting for reporting purposes, convert the string into that format.

Ben
Highlighted
7 - Meteor

I can't use seconds in my calculation. Is there a way to trim off the seconds?? Needs to be the date hours and minutes

Highlighted
7 - Meteor

I can't have seconds. I need just the date, hours and minutes. Is there a way to trim the seconds off?

Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

Did you know that you can trim a date/time?

 

DateTimeTrim([DateTime Field],"Minutes")  will create all data as :00 seconds.  If you apply this to both sides of an equation, this might be helpful.

 

Cheers,

Mark

Alteryx ACE & Top Community Contributor

Chaos reigns within. Repent, reflect and reboot. Order shall return.
Highlighted
Alteryx Certified Partner
Alteryx Certified Partner

datetimetrim([field],'minutes')

 

the seconds will show but they will all be set to 00

 

In Alteryx you have three views for dates/times.

 

Date YYYY-MM-DD

 

Time HH:MM:SS

 

DateTime YYYY-MM-DD HH:MM:SS

 

A datetime field cannot be seen as a datetimefield without all these aspects but you can 'trunc' them using the function outlined above.

Labels