Drupal 7 - time and date field to integer and a view summary
Ngân sách €30-250 EUR
- Freelancer
- Các công việc
- Drupal
- Drupal 7 - time and date field to integer and a view summary
1) I need code in PHP for drupal computed field ([login to view URL]) that would calculate difference in days between two dates e.g. :
date 1: 1st may 2019
date 2: 20 July 2020
date 2 - date 1 = circa 365 + 80 days = 445 days
and provide it as an integer value as a number of years, that I could further use for extra calculations.
445 days (calculated difference) / 365 (average year) = 1.219
that number (difference in days as a number of years) should be the output of the code.
2) some values would be provided as char or string. The code should account for it.
A draft version of the code:
$value1_energy1 = field_get_items($entity_type, $entity, 'field_energy1');
$value2_energy2 = field_get_items($entity_type, $entity, 'field_energy2');
if ($value2_energy2[0]['value'] > '0') {
$entity_field[0]['value'] = $value2_energy2[0]['value']*0.000351 + $value1_energy1 [0]['value']*0.000812;
}else{
$entity_field[0]['value'] = $value1_energy1[0]['value']*0.000812;
}
This is just a basic calculation and:
a) there is no date field included
b) valued1 and value2 could be provided as a string (and have a space or a comma instead of a dot).
3) those calculated values shoud be summed up in a view
There is a view with a list of nodes, and at the bottom of the view we need to provide a sum of those calculated values
example of the view with fomulas:
[login to view URL]
8 freelancer chào giá trung bình€192 cho công việc này
Hello sir, I check [login to view URL] carefully and I am absolutely sure that I can do the project very well. We are enthusiastic team of developer a complete package for the successful exec Thêm
Hi, Greetings! ✅checked your project details: Drupal 7 - time and date field to integer and a view summary ✅Completed Time: In project deadline We have worked on 640 + Projects. I have 6 + years of the experien Thêm
Hi, Greetings! ✅checked your project details :Drupal 7 - time and date field to integer and a view summary ✅Completed Time : 24 hours or your requirement deadline . I would like to work on your project and want to be Thêm