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

Alteryx designer Discussions

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

Date Time Formatting

Alteryx Certified Partner

Hi community,

 

I have the following date format for the date field 'YYYY-MM-DD' and I would like to somehow calculate only the dates that are 'Saturday'. Is there anyway to do this?

Alteryx Alumni (Retired)

You can create a new field in a Formula tool with the expression...

 

DateTimeParse([YourDateField], "%A")

 

...which gives you the day of the week. Then just filter on "Saturday".

 

You can check out all of the Date Specifiers in Help.

Alteryx Certified Partner

Thanks Rod! I just tried and it says 'Error: Malformed Function Call'

 

I wrote this: DateTimeParse([Transaction Date],%A)

 

I checked the format type of the 'Transaction Date' field and it is indeed 'Date'. So I don't know what could be wrong.... Any ideas?

Highlighted
Alteryx Alumni (Retired)

You need quotes around the specifier...

Alteryx Certified Partner

Thank you!

 

Ok hopefully last question... Alteryx says it cannot convert to weekday because..."  DATETIMEPARSE: Cannot convert "2016-04-20" to a date/time with format "%A":  Weekday is out of range 0..6"

 

 

Alteryx Alumni (Retired)

Sorry, @rwood330, this one is totally on me.

It should have been...

 

DateTimeFormat([YourDate], "%A")

 

DateTimeFormat goes from Date to String.

DateTimeParse goes from String to Date.

 

I totally messed you up. ;-(

 

Labels