C
|
cgphp 3/20/2012 |
Do you want to show on a field in the list page the days till today? |
![]() |
swami author 3/20/2012 |
Do you want to show on a field in the list page the days till today?
|
C
|
cgphp 3/20/2012 |
Set the field as Custom in the "View as" setting and enter the following code: $value = floor((time() - strtotime($value)) / 86400); |
![]() |
swami author 3/20/2012 |
Set the field as Custom in the "View as" setting and enter the following code: $value = floor((time() - strtotime($value)) / 86400);
|
C
|
cgphp 3/20/2012 |
It looks like your date field is not a date type. How do you save dates in the db? As datetime? |
![]() |
swami author 3/20/2012 |
It looks like your date field is not a date type. How do you save dates in the db? As datetime?
|
C
|
cgphp 3/20/2012 |
Have you set the "Custom" setting for the right field? |
![]() |
swami author 3/20/2012 |
Have you set the "Custom" setting for the right field?
|
C
|
cgphp 3/20/2012 |
What is the name of the field where you want to see the number of the days? |
![]() |
swami author 3/20/2012 |
What is the name of the field where you want to see the number of the days?
|
C
|
cgphp 3/20/2012 |
Set due_date as Custom and enter the following code: $value = floor((time() - strtotime($data['date'])) / 86400);
|
![]() |
swami author 3/20/2012 |
Set due_date as Custom and enter the following code: $value = floor((time() - strtotime($data['date'])) / 86400);
|
C
|
cgphp 3/20/2012 |
No, datetime is correct. |
![]() |
swami author 3/20/2012 |
No, datetime is correct.
|
C
|
cgphp 3/20/2012 |
Which format is used for the date in the database? Dates in the m/d/y or d-m-y formats are disambiguated by looking at the separator between the various components: if the separator is a slash (/), then the American m/d/y is assumed; whereas if the separator is a dash (-) or a dot (.), then the European d-m-y format is assumed. To avoid potential ambiguity, it's best to use ISO 8601 (YYYY-MM-DD) dates |
![]() |
swami author 3/20/2012 |
Which format is used for the date in the database? From the strtotime function docs:
|
C
|
cgphp 3/20/2012 |
Coul you post a screenshot of your table structure and data in phpmyadmin? |
![]() |
swami author 3/20/2012 |
Coul you post a screenshot of your table structure and data in phpmyadmin?
|
C
|
cgphp 3/20/2012 |
Please, post a screenshot of phpmyadmin of the data not only the structure. |
![]() |
swami author 3/21/2012 |
Please, post a screenshot of phpmyadmin of the data not only the structure.
|
C
|
cgphp 3/21/2012 |
Try this version: $value = intval((time() - strtotime($data['date'])) / 86400); |
![]() |
swami author 3/21/2012 |
Try this version: $value = intval((time() - strtotime($data['date'])) / 86400);
$value = $data["due_date"];
|
C
|
cgphp 3/21/2012 |
You don't need the first line. The only code needed is the following: $value = intval((time() - strtotime($data['date'])) / 86400); |
![]() |
swami author 3/21/2012 |
You don't need the first line. The only code needed is the following: $value = intval((time() - strtotime($data['date'])) / 86400);
|
C
|
cgphp 3/21/2012 |
Ok, I have found the bug. The date field name is date_time not date. Try this version: $value = intval((time() - strtotime($data['date_time'])) / 86400); |
![]() |
swami author 3/21/2012 |
Ok, I have found the bug. The date field name is date_time not date. Try this version: $value = intval((time() - strtotime($data['date_time'])) / 86400);
|