protected function DemoNode::createDate in Open Social 8
Same name and namespace in other branches
- 8.9 modules/custom/social_demo/src/DemoNode.php \Drupal\social_demo\DemoNode::createDate()
- 8.2 modules/custom/social_demo/src/DemoNode.php \Drupal\social_demo\DemoNode::createDate()
- 8.3 modules/custom/social_demo/src/DemoNode.php \Drupal\social_demo\DemoNode::createDate()
- 8.4 modules/custom/social_demo/src/DemoNode.php \Drupal\social_demo\DemoNode::createDate()
- 8.5 modules/custom/social_demo/src/DemoNode.php \Drupal\social_demo\DemoNode::createDate()
- 8.6 modules/custom/social_demo/src/DemoNode.php \Drupal\social_demo\DemoNode::createDate()
- 8.7 modules/custom/social_demo/src/DemoNode.php \Drupal\social_demo\DemoNode::createDate()
- 8.8 modules/custom/social_demo/src/DemoNode.php \Drupal\social_demo\DemoNode::createDate()
- 10.3.x modules/custom/social_demo/src/DemoNode.php \Drupal\social_demo\DemoNode::createDate()
- 10.0.x modules/custom/social_demo/src/DemoNode.php \Drupal\social_demo\DemoNode::createDate()
- 10.1.x modules/custom/social_demo/src/DemoNode.php \Drupal\social_demo\DemoNode::createDate()
- 10.2.x modules/custom/social_demo/src/DemoNode.php \Drupal\social_demo\DemoNode::createDate()
Converts a date in the correct format.
Parameters
string $date_string: The date.
Return value
int|false Returns a timestamp on success, false otherwise.
1 call to DemoNode::createDate()
- DemoNode::createContent in modules/
custom/ social_demo/ src/ DemoNode.php - Creates content.
File
- modules/
custom/ social_demo/ src/ DemoNode.php, line 130
Class
- DemoNode
- Class DemoNode.
Namespace
Drupal\social_demoCode
protected function createDate($date_string) {
if ($date_string === 'now') {
return time();
}
// Split from delimiter.
$timestamp = explode('|', $date_string);
$date = strtotime($timestamp[0]);
$date = date('Y-m-d', $date) . 'T' . $timestamp[1] . ':00';
return strtotime($date);
}