Solved

Help formatting date and time

  • 26 May 2022
  • 5 replies
  • 136 views

Badge +1
  • New Participant
  • 8 replies

I need to make this date format presentable: 2022-06-24 12:00:00 MST-0700

I have tried variations of ... |format_date_string|date:'Y-m-d h:i:s tO' but no luck.

Regular timestamp would respond to something like this .. format_date_string|date:'M d, o'

Any ideas?

icon

Best answer by gmc 27 May 2022, 19:36

View original

5 replies

Userlevel 6
Badge +54

Hi there @gmc,

Welcome to the Community!
Could you explain what error is occurring exactly when trying to input a date format into your design? Any screenshot of what is happening vs expected behavior would be helpful in finding a solution.

I also recommend looking at our help center article related to formatting date variables.

 

Thanks!
Alex

Badge +1

I think the one I’m trying (or need) to use “Date 1” might not be an acceptable format (date time timezone)
If I format it {{ event.date1|format_date_string|date:'M d, y }} the result is blank, whereas date formats 2 and 3 render correctly. Date 2 being a regular timestamp.

Userlevel 6
Badge +54

Hi @gmc,

If you want to add the time with your date you can use this code below which is formatted in a 24hr format:

{{ event.time|format_date_string|date:'Y-m-d'}}, {{ event.time|time:'H:i'}} 

 If you want it to show in a 12 hour format you can use this:

{{event.time|format_date_string|date:'Y-m-d'}}, {{ event.time|time:'h:i' }}

 You may see a time difference since the event data is showing in UTC time whereas the time showing in the actual email is in your account timezone.

 

Let me know if that helped,

Alex

Badge +1

Thanks for the reply.

I couldn’t get it working quite like you had it, but got it working with this. (I added a space in italicized description above so it didn’t render)

{{event.mydate|format_date_string|date:'Y-m-d'}}, {{event.mydate|format_date_string|date:'H:i'}}

However, the format of mydate 1 is not parsing using the same method.

 

Badge +1

Sort of resolved - going to have the timestamp outputted in a supported format.

For the record, this is not a supported format: 2022-05-30 15:00:00 PDT-0700

Reply