This topic is locked
[SOLVED]

 How to set today date as default value in date field?

3/20/2012 11:21:07 AM
PHPRunner General questions
C
CK. author

I try to assign today date as default value to a date field when adding new record.
But the field keep showing 'dd-mm-yyyy HH:MM:SS'.
How to make the field just show only 'dd-mm-yyyy'?
I tested on date('d-m-Y'), Now() and both return 'dd-mm-yyyy HH:MM:SS'.
Thank in advances.
php.newbie

C
cgphp 3/20/2012

Set the "View as" setting as Short Date or Long Date.

jimbeam 3/20/2012

View as --> Short/Long/Datetime/Time
and if it's not enough you play with custom and you format it using php

C
CK. author 3/20/2012



View as --> Short/Long/Datetime/Time
and if it's not enough you play with custom and you format it using php


Not working. Default is Short Date but still display 'dd-mm-yyyy HH:MM:SS'.
Just wonder what to input in Default Value for date format.

C
cgphp 3/20/2012

In the "View as" setting set the field as Custom and enter the following code:

$value = date('d-m-Y',strtotime($value));
C
CK. author 3/20/2012



In the "View as" setting set the field as Custom and enter the following code:

$value = date('d-m-Y',strtotime($value));



Follow your code and the field shown BLANK.

C
cgphp 3/20/2012

Is the type of the field in DB a datetime?

C
CK. author 3/20/2012



Is the type of the field in DB a datetime?


Nobe. field type is DATE.
I'm using PHPRunner 6.1
But when you pick date from datepicker, it return dd-mm-yyyy format.

C
cgphp 3/20/2012

Please, check the functionality in a stable version.

C
CK. author 3/20/2012



Please, check the functionality in a stable version.


Thanks Cristian Gilè,
I use 6.1 coz I need the 'use different setting for all pages' features.
But anyway, at the mean time, let the field be BLANK and let customer pick the date from datepicker.
Regards,

php.newbie

Admin 3/20/2012

Something doesn't sound right here. Default value suggested by Cristian should just work.
If more help is required post your application to Demo Account and open a ticket at http://support.xlinesoft.com sending your Demo Account URL. 'Demo Account' button can be found on the last screen in the program.

C
CK. author 3/23/2012

Problem fixed.
Just set the default value to date('Y-m-d') follow the date format in MySQL will do.
Many thanks to Support Team.
Regards,

php.Newbie