Example of using this with a date field from a node in order to get it to format the date in the correct timezone
use Drupal\Core\Datetime\DrupalDateTime;
$date = new DrupalDateTime($mynode->field_my_date_field->value, 'UTC');
$formatted_date = \Drupal::service('date.formatter')->format($date->getTimestamp(), 'custom', 'F j, Y h:ia');
Drupal Commerce
Drupal Commerce provides a truly flexible, solid foundation for building even very complex business applications. Some of the reasons it stands out as an excellent and secure solution are the following:
Create an administrator user in Drupal using Drush (Drupal 10 & 11)
In otder to create a new user in your website using drush, you'll need to run the following commands:
$ drush user-create YourUsername --mail="your@mail.com" --password="YourPassword"
This will create a new user in the website.
In order to assign the role administrator to the user run:
$ drush user-add-role "administrator" YourUsername
Updated for Drupal 11 (2026)
Who uses Drupal?
Why Drupal?
Drupal is the leading open source content management system for developing sophisticated, flexible and robust websites, social media networks and applications.
Drupal 8: How to include the node id and a class in body based on the , depending on the current path
Drupal 7: Views pager not showing!
Drupal 7: Addressfield - Change the order of the inner fields
Drupal 7: Heartbeat comment messages show up twice!
Configuring drupal cron jobs in crontab.
Drupal 7 has the ability to run cron automatically, but if there are tasks that really depend on cron, it only makes sense to ensure that cron is running in pre-defined time spans.
To make sure of that, we can configure the drupal cron to run from a server side command. So from the console, In crontab, the following line will trigger Drupal's cron