• DOCUMENTATION
  • WORKATO BLOG
  • PRODUCT BLOG
  • Return to Workato
  • Log in
  • ☰
  • Community/Discussions
Solution home Formula Mode Tips & Tricks Date/Time Formulas

Date formatting: to_date versus strftime

Modified on: Thu, Aug 29, 2019 at 5:47 AM

There are 2 datetime formatting functions supported in formula mode that look similar. When should you be using which function?


to_date

Input: Date/time or String 

Output: Date/time 

Use to_date when you need to specify the input data's format. For example, if I'm passing in an ambiguous date (05/10/2016) in the MM/DD/YYYY format, and not the DD/MM/YYYY format, I can use the to_date(format: "MM/DD/YYYY") function to make it very clear to the recipe what date format it is in.


strftime

Input: Date/time 

Output: String 

This function takes in only datetime data types and outputs them as a string in a certain format specified in the function. For example, I need to add a date to my Google Sheets in the "MM/DD/YYYY" format. If a data pill with the date/time type is mapped directly to Google Sheets, it appears as "2016-08-05 10:20:50 -0700". Instead of mapping the data pill directly to my Google Sheets action, I can use the strftime("%m/%d/%Y") function to format the output and send it to Google Sheets as "08/05/2016".


For more information on the placeholder values that can be used with the strftime function, refer to our common formula (operators) list.

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.

Related Articles

    Still can't find your solution?

    Visit our forums to search for answers, or post your own questions.

    Documentation
    Developer's Library
    Tutorials
    eBooks
    Product Hour
    Product Blog
    Workato Blog
    Product updates
    Customer Stories
    © Workato 2020   Privacy   Terms   +1 (844) 469-6752
    • Documentation
    • Workato Blog
    • Product Blog
    • Solutions
    • Forums
    • Tickets
    • Log in
    • Return to Workato