Page 1 of 1

Formating Time with php variables

Posted: Mon Jan 09, 2017 3:27 pm
by buckinghamhouse
I am trying to format the Template Variable to show the date in a 24hr format. But when I use the formatting parameters such as %H:%M:%S included in the variable like so: [BOOKINGTIMEDATE: {%H:%M:%S}] the variable doesn't seem to be converting. I had expected the time variables to work like the date variables on the help link about Template Variable but I must be missing some key piece of the syntax.

Re: Formating Time with php variables

Posted: Tue Jan 10, 2017 8:56 am
by lesleywoermeijer
Hi,

You can use [BOOKINGDATE: {%H:%M:%S}] with the formating or [BOOKINGTIMEDATE] without the formatting.

Please check the Template Variable page for the fields that can be formatted : - https://wiki.beds24.com/index.php?title ... _Variables

Re: Formating Time with php variables

Posted: Tue Jan 10, 2017 1:21 pm
by buckinghamhouse
lesleywoermeijer wrote:Hi,

You can use [BOOKINGDATE: {%H:%M:%S}] with the formating or [BOOKINGTIMEDATE] without the formatting.
Looking at the available variables and the description on the help file I expected the following variable with modifiers to return both the date and time in the form I am making with the custom date template variables as per the description provided:

[BOOKINGDATE: {%a, %e %a, %y, %H:%M:%S}]

But it just showed up as the code above instead. So how do you use the modifiers to show the date AND time?

Re: Formating Time with php variables

Posted: Tue Jan 10, 2017 2:29 pm
by lesleywoermeijer
I have just tested your setting [BOOKINGDATE: {%a, %e %a, %y, %H:%M:%S}] and this is the result for my booking page :- Tue, 10 Tue, 17, 14:26:45. Is this not what you are expecting to see?

Re: Formating Time with php variables

Posted: Tue Jan 10, 2017 2:38 pm
by markkinchin
buckinghamhouse wrote:
[BOOKINGDATE: {%a, %e %a, %y, %H:%M:%S}]

But it just showed up as the code above instead. So how do you use the modifiers to show the date AND time?
Make sure there are no HTML codes in your entire template code, it must be pure text.
You can check the content in the editor's source mode to make sure there is no stray content.

Re: Formating Time with php variables

Posted: Tue Jan 10, 2017 2:56 pm
by buckinghamhouse
Got it to work using your input Mark, thank you very much!