Solved

timestamp formats customization

  • 3 March 2023
  • 4 replies
  • 213 views

Badge +2

Hei guys 
that’s my first question to the comunity hope you can help. So I ve a doubt that I m not able to solve. 

I m using an external no code platform from which I m taking data as Customer Property into Klavyio. My company is working on the telemedicine and I ask patient to book doctor appointments.

Example is: 
Patient is booking a slot time and then I want to confirm him/her that his booking is confirmed (same day email) and I want to remember them at a later time that he will have the visit. 

I m taking data from the app and specifically I am grasping the slot time and the date picked by the patient.

The date is coming as follows: MM/DD/YYYY HH:MM:SS am/pm

Now I am able to transfer this info in Klavyio and I am able to write this data also in as a customization in the email I ll send them. As you can imagine this is not optimal. How can I compress the data into only MM/DD/YYYY?

icon

Best answer by retention 3 March 2023, 19:52

View original

4 replies

Userlevel 7
Badge +57

Hi @Gb1996, welcome to the community!

Within Klaviyo templates, you can use something called “Filters” which lets you do some basic string manipulation for a given variable such as your custom property for the booking slot time. There’s a specific Filter called “format_date_string” that does exactly that, take one format of a Date and converts it to another.

Here’s an example you can try:

{{ your_variable|format_date_string|date:'n/j/y' }}

This should present the date in a m/dd/yy format.

You can see other options or learn more about the date format filter in this documentation:

Hope this helps and let us know if it worked!

Badge +2

Heiiii it worked perfectly! 
Thank you so much for the quick response :) You are the best

Badge +2

I ve an additional question to that. 
How do I make it in another language that “march”? I would love to place the italian language there :) 
 

 

Userlevel 7
Badge +60

Hey @Gb1996 

One idea would be to build in an if/else statement I.E. if March, then [Italian version]. Alternatively, you could also just have that date come through as a text format with the italian version already written out to reference.

Reply