Asked  7 Months ago    Answers:  5   Viewed   28 times

I'm trying to take a date object that's coming out of my Drupal CMS, subtract one day and print out both dates. Here's what I have

$date_raw = $messagenode->field_message_date[0]['value'];


//this gives me the following string: 2011-04-24T00:00:00

$date_object = date_create($date_raw);

$next_date_object = date_modify($date_object,'-1 day');

print('First Date ' . date_format($date_object,'Y-m-d'));

//this gives me the correctly formatted string '2011-04-24'

print('Next Date ' . date_format($next_date_object,'Y-m-d'));

//this gives me nothing. The output here is always blank

So I'm not understanding why the original date object is coming out fine, but then I'm trying to create an additional date object and modify it by subtracting one day and it seems like I can't do that. The output always comes out blank.



You can try:

print('Next Date ' . date('Y-m-d', strtotime('-1 day', strtotime($date_raw))));
Wednesday, March 31, 2021
answered 7 Months ago

You should point to your vendor/autoload.php at Settings | PHP | PHPUnit when using PHPUnit via Composer.

This blog post has all the details (with pictures) to successfully configure IDE for such scenario:

Related usability ticket:

P.S. The WI-18388 ticket is already fixed in v8.0

Wednesday, March 31, 2021
answered 7 Months ago

On Mac OS X environment variables available in Terminal and for the normal applications can be different, check the related question for the solution how to make them similar.

Note that this solution will not work on Mountain Lion (10.8).

Saturday, May 29, 2021
answered 5 Months ago

If you have the BCMath extension you can use this:

$a = bcsub('294867828828426241', '1');

echo $a; // 294867828828426240

However, testing on my 64-bit server your code should work correctly. I'm not sure, but you can check to see if increasing the precision directive in your php.ini will make any difference. I have mine set at 14.

Saturday, May 29, 2021
answered 5 Months ago

I guess that you are following the Amazon tutorial to install phpMyAdmin ?

I had the same problem today and resolved it by uninstall PHP 7.0 with the yum command (the same given by Amazon with 'remove' instead of 'install' :

sudo yum remove httpd24 php70 mysql56-server php70-mysqlnd

and installed PHP 5.6 instead :

sudo yum install httpd24 php56 mysql56-server php56-mysqlnd

I don't know if this is a good solution, but it worked and I could install phpMyAdmin without dependencies problem. I hope it will help :)

Tuesday, August 10, 2021
answered 2 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :