This topic is locked
[SOLVED]

 Date format

1/18/2021 8:53:56 AM
PHPRunner General questions
A
admin author

Hi,
how can we set the date format to show 18-Jan-2021 in View as setting. date view as the property has only two settings short date and long date but for some reason, we need to set the date format as 18-Jan-2021. Appreciate it if someone can guide how to achieve it.
Thanks & regards

Sami

aadham 1/18/2021



Hi,
how can we set the date format to show 18-Jan-2021 in View as setting. date view as the property has only two settings short date and long date but for some reason, we need to set the date format as 18-Jan-2021. Appreciate it if someone can guide how to achieve it.
Thanks & regards

Sami


Hi Sami

I use the following in "View As>Custom"

$value = date("M d, Y g:i A", strtotime($value));


The result of the above will be like: Jan 18, 2021 5:07 AM, but you can change it to suit your needs.

A
admin author 1/18/2021

Thanks Aadham,

but it is working for a current date while I need to show this for stored date on list page. So how can we pass date as a variable in this function/
regards

Sami

aadham 1/18/2021



Thanks Aadham,

but it is working for a current date while I need to show this for stored date on list page. So how can we pass date as a variable in this function/
regards

Sami



The code above will display whatever date stored in your DB

A
admin author 1/19/2021

Thanks & appreciate your guidance.

It worked well.
regards

Sami

aadham 1/19/2021



Thanks & appreciate your guidance.

It worked well.
regards

Sami



I'm glad I could be of help.

Good luck