This topic is locked

date formatting

9/30/2010 7:31:13 AM
PHPRunner General questions
T
tedwilder author

hello
I'm in France so we use d/m/2010
I can with phprunner put my date with " short" date as "view" on editor, and choose french format and even defaut as: date("d/m/Y").the field in table is a date one.

it's great: i see it correctly in my add/list pages. BUT when I want to retrieve data from " $values["date"] " i get what is recorded in the database that is to say : 2010-09-29 ( Y-m-d) And it's quite complicated because then each time I will have to use date value in events ( to create pdf and mail resusts for instance) i will have to code to correct the format..

Is there any way to make mysql record the date 29/09/2010 and not 2010-09-29.

if I tried to use "varchar" instead of "date" in table for this field but it records the same thing and add 00:00:00 for time..
thanks for your help.

J
jdu001 9/30/2010

Hello,
Are your Windows date settings correct?
I'm Dutch and I also have dates in the database ad Y-m-d.

In PHPRunner 5.2 I use:

View as settings: Short date

Edit as settings: Date and the chosen Date format: DD/MM/YYYY Francais (France)
My dates are shown correct both in lists as in add/edit forms when I alter the Date format.
Success,
Jo van Duin



hello
I'm in France so we use d/m/2010
I can with phprunner put my date with " short" date as "view" on editor, and choose french format and even defaut as: date("d/m/Y").the field in table is a date one.

it's great: i see it correctly in my add/list pages. BUT when I want to retrieve data from " $values["date"] " i get what is recorded in the database that is to say : 2010-09-29 ( Y-m-d) And it's quite complicated because then each time I will have to use date value in events ( to create pdf and mail resusts for instance) i will have to code to correct the format..

Is there any way to make mysql record the date 29/09/2010 and not 2010-09-29.

if I tried to use "varchar" instead of "date" in table for this field but it records the same thing and add 00:00:00 for time..
thanks for your help.

T
tedwilder author 9/30/2010



Hello,
Are your Windows date settings correct?
I'm Dutch and I also have dates in the database ad Y-m-d.

In PHPRunner 5.2 I use:

View as settings: Short date

Edit as settings: Date and the chosen Date format: DD/MM/YYYY Francais (France)
My dates are shown correct both in lists as in add/edit forms when I alter the Date format.
Success,
Jo van Duin


Well with premade list /add page it works ok as I said. But in events when I want to retrieve the data values with $values["date"] I get a non formatted values not the correct date format.

Sergey Kornilov admin 9/30/2010

Date values are always stored in the database as yyyy-mm-dd. This is a universal database date format. You need to format your date values in events manually.
See example here: http://stackoverflow.com/questions/1535246/php-format-date-from-database