This topic is locked
[SOLVED]

 Confusing date formats

5/28/2020 7:13:34 AM
PHPRunner General questions
K
kohle author

Date formats
1)

field page -> custom code
you get Y-m-d from $data
2)

in a custom button , server event

you get from a $data = $button->getCurrentRecord();

the language format of the misc. page
for german :

d.m.Y
3)

Search box works only with Y-m-d
How I can change this, for my german customers ? Should it not be like defined on the misc. page ?
Is this a bug ? I need help

HJB 5/28/2020

https://xlinesoft.com/phprunner/docs/edit_as_settings_date.htm
RED underlined date field in screenshot #1 refers, make sure, it's switched to German.

Sergey Kornilov admin 5/28/2020

A few things you need to know.

  1. Dates are always stored in the database in yyyy-mm-dd
  2. If you use any API or retrieve data manually and need to display it to the end-user - you need to format it according to your regional settings.
  3. When your users input dates I recommend using datepickers to avoid any chance of incorrect date format. This applies to both Edit and Search pages.

K
kohle author 5/28/2020



A few things you need to know.

  1. Dates are always stored in the database in yyyy-mm-dd
  2. If you use any API or retrieve data manually and need to display it to the end-user - you need to format it according to your regional settings.
  3. When your users input dates I recommend using datepickers to avoid any chance of incorrect date format. This applies to both Edit and Search pages.


Thanks for your response.
The date is set in the edit field and misc. page for the german format.

But the all field search box only allow the search in Y-m-D format.
Before I update to 10.5 I must be sure my german customers can search with the correct date format. And this is dd.mm.yyyy
Maybe there is a event before_search or something? Than I could format the data before search.
I can convert the following, no probem but confusing :
About API, I dont know if this is an api , $data = $button->getCurrentRecord();

but it returns the correct german format.
In a snippet the $data returns the database format Y-m-d