Search
 
SCRIPT & CODE EXAMPLE
 

PHP

php messageformatter

MessageFormatter does not work with DateTime instances as parameters in PHP < 5.5. Instance will be converted to timestamp with value 0 (e.g. 1970-01-01) and following Notice will be raised: „Object of class DateTime could not be converted to int“. You have to manually convert the instance to timestamp in these old PHP versions.

<?php
$datetime = new DateTime();
if (PHP_VERSION_ID < 50500) { // PHP < 5.5 needs conversion to timestamp
   MessageFormatter::formatMessage('en_US', 'Today is {0, date, full}.', array($datetime->getTimestamp()));
} else {
   // current code
   MessageFormatter::formatMessage('en_US', 'Today is {0, date, full}.', array($datetime));
}
?>
Comment

PREVIOUS NEXT
Code Example
Php :: google calendar api push notifications php 
Php :: how to convert php code to html 
Php :: How to remove repetitive values from foreach loop in php laravel 
Php :: convert php array into json online 
Php :: larqavel migration 
Php :: how to fetch group name in custom post type in wordpress 
Php :: install tinymce php 
Php :: if ( $post_armi-have_posts() ) { while ($post_armi-have_posts() ) { $post_armi-the_post(); 
Php :: MySQL eqSql Connection 
Php :: cakephp3 form control plus traditional php form 
Php :: composer in serveur ionos 
Php :: php datetime format 
Php :: How to prevent repeating the same option value of a selection in a php loop 
Php :: Fehler beim Uploadtest der ausgewählten Datei. 
Php :: simple pyramid pattern 
Php :: array length php for loop 
Php :: how to filter the all special characters in cakephp from an array 
Php :: docker php-fpm 
Php :: add attachment to the invoice laravel 
Php :: php include inside function global 
Php :: after jquery validation ajax call in php 
Php :: php to python converter online free 
Php :: Laravel Eloquent sum of multiplied columns 
Php :: stupidity 
Php :: php json array push in js file 
Php :: https://stackoverflow.com/questions/58589741/angular-8-hide-divs-and-show-div-on-button-click 
Php :: avoid web crawling in Laravel 
Php :: laravel resourece type 
Php :: check backend post type 
Php :: import csv to laravel 
ADD CONTENT
Topic
Content
Source link
Name
3+7 =