Created 2013-05-31 20:44:00
Updated 2020-06-02 00:22:41
<script type="text/javascript"> var objDate; objDate = new Date("Jun 06, 2023 07:14:25 GMT+0200"); <script>We are trying to get the PHP date format string to format date time to form the pipeline PHP DateTime() => js Date() => document.write() to output on screen. Here is the summary of cases we tested for you:
# | js new Date() Feed | IE | Chrome | Firefox | Safari | Opera | Mobile |
---|---|---|---|---|---|---|---|
0 | Jun 06, 2023 07:14:25 GMT+0200 | + | + | + | + | + | + |
1 | Jun 06 2023 07:14:25 GMT+0200 | + | + | + | + | + | + |
2 | Jun 06, 2023 07:14:25 GMT+2 | + | + | + | + | + | + |
3 | 2023-06-06 07:14:25 GMT+0200 | - | + | - | - | + | + |
4 | 2023-06-06 07:14:25 GMT+02:00 | - | + | - | - | + | + |
5 | 2023-06-06 07:14:25 GMT+200 | - | + | - | - | + | + |
6 | 06 Jun 2023 07:14:25+02:00 | - | + | - | - | - | - |
7 | Jun 06 2023 07:14:25 GMT+2:00 | - | + | + | - | + | + |
8 | Jun 06, 2023 07:14:25 GMT+02:00 | - | + | + | - | + | + |
9 | 2023-06-06 07:14:25 GMT+2 | - | + | - | - | + | + |
10 | 2023-06-06 07:14:25 | - | + | - | - | + | + |
11 | 2023-06-06T07:14:25+02:00 | + | + | + | + | + | - |
12 | 2023-06-06 07:14:25+02:00 | - | + | - | - | - | - |
13 | 06-06-2023 07:14:25 GMT+0200 | + | + | - | - | - | + |
14 | 06/06, 2023 07:14:25 GMT+0200 | + | + | + | - | + | + |
15 | 06-Jun-2023 07:14:25 GMT+0200 | - | + | - | + | - | + |
JavaScript is very English speaking. In effect, among the 3 first universal formats, the English month abbreviation is used. As it can be observed that no pure numerical date string is found like "2023-06-06 07:14:25" to fit JavaScript syntax in all browsers. Please check this with your preferred browser.
Below, the bold date time outputs at the right hand side of => are the JavaScript Date Class results.
For example, Jun 06, 2023 07:14:25 GMT+0200 =>
# | js new Date() Feed | IE | Chrome | Firefox | Safari | Opera | Mobile |
---|---|---|---|---|---|---|---|
0 | Jun 06, 2023 07:14:25 GMT+0200 | + | + | + | + | + | + |
This format is valid for all browsers in our hands, including Internet Explorer,
Google Chrome, Firefox, Safari, Opera, Mobile Safari.
On PHP, you get this DateTime format of the current time by
<?php $objDateTime = new DateTime(); $strDateTime = $objDateTime->format("M d, Y H:i:s \G\M\TO"); ?>One observes that this is the Standard English Date Time expression.
For example, Jun 06 2023 07:14:25 GMT+0200 =>
# | js new Date() Feed | IE | Chrome | Firefox | Safari | Opera | Mobile |
---|---|---|---|---|---|---|---|
1 | Jun 06 2023 07:14:25 GMT+0200 | + | + | + | + | + | + |
This format is also valid for all browsers in our hands, including IE,
Google Chrome, Firefox, Safari, Opera, Safari Mobile.
On PHP, you get this DateTime format of the current time by
<?php $objDateTime = new DateTime(); $strDateTime = $objDateTime->format("M d Y H:i:s \G\M\TO"); ?>One notes that this is another English Date Time expression with timezone.
For example, Jun 06, 2023 07:14:25 GMT+2 =>
# | js new Date() Feed | IE | Chrome | Firefox | Safari | Opera | Mobile |
---|---|---|---|---|---|---|---|
2 | Jun 06, 2023 07:14:25 GMT+2 | + | + | + | + | + | + |
All following date time strings are good for some browsers, but unfortunately bad for others.
For example, 2023-06-06 07:14:25 GMT+0200 =>
# | js new Date() Feed | IE | Chrome | Firefox | Safari | Opera | Mobile |
---|---|---|---|---|---|---|---|
3 | 2023-06-06 07:14:25 GMT+0200 | - | + | - | - | + | + |
For example, 2023-06-06 07:14:25 GMT+02:00 =>
# | js new Date() Feed | IE | Chrome | Firefox | Safari | Opera | Mobile |
---|---|---|---|---|---|---|---|
4 | 2023-06-06 07:14:25 GMT+02:00 | - | + | - | - | + | + |
For example, 2023-06-06 07:14:25 GMT+02:00 =>
# | js new Date() Feed | IE | Chrome | Firefox | Safari | Opera | Mobile |
---|---|---|---|---|---|---|---|
5 | 2023-06-06 07:14:25 GMT+200 | - | + | - | - | + | + |
For example, 06 Jun 2023 07:14:25+02:00 =>
# | js new Date() Feed | IE | Chrome | Firefox | Safari | Opera | Mobile |
---|---|---|---|---|---|---|---|
6 | 06 Jun 2023 07:14:25+02:00 | - | + | - | - | - | - |
For example, Jun 06 2023 07:14:25 GMT+2:00 =>
# | js new Date() Feed | IE | Chrome | Firefox | Safari | Opera | Mobile |
---|---|---|---|---|---|---|---|
7 | Jun 06 2023 07:14:25 GMT+2:00 | - | + | + | - | + | + |
For example, Jun 06, 2023 07:14:25 GMT+02:00 =>
# | js new Date() Feed | IE | Chrome | Firefox | Safari | Opera | Mobile |
---|---|---|---|---|---|---|---|
8 | Jun 06, 2023 07:14:25 GMT+02:00 | - | + | + | - | + | + |
For example, 2023-06-06 07:14:25 GMT+2 =>
# | js new Date() Feed | IE | Chrome | Firefox | Safari | Opera | Mobile |
---|---|---|---|---|---|---|---|
9 | 2023-06-06 07:14:25 GMT+2 | - | + | - | - | + | + |
For example, 2023-06-06 07:14:25 =>
# | js new Date() Feed | IE | Chrome | Firefox | Safari | Opera | Mobile |
---|---|---|---|---|---|---|---|
10 | 2023-06-06 07:14:25 | - | + | - | - | + | + |
For example, 2023-06-06T07:14:25+02:00 =>
# | js new Date() Feed | IE | Chrome | Firefox | Safari | Opera | Mobile |
---|---|---|---|---|---|---|---|
11 | 2023-06-06T07:14:25+02:00 | + | + | + | + | + | - |
For example, 2023-06-06 07:14:25+02:00 =>
# | js new Date() Feed | IE | Chrome | Firefox | Safari | Opera | Mobile |
---|---|---|---|---|---|---|---|
12 | 2023-06-06 07:14:25+02:00 | - | + | - | - | - | - |
For example, 06-06-2023 07:14:25 GMT+0200 =>
# | js new Date() Feed | IE | Chrome | Firefox | Safari | Opera | Mobile |
---|---|---|---|---|---|---|---|
13 | 06-06-2023 07:14:25 GMT+0200 | + | + | - | - | - | + |
For example, 06/06, 2023 07:14:25 GMT+0200 =>
# | js new Date() Feed | IE | Chrome | Firefox | Safari | Opera | Mobile |
---|---|---|---|---|---|---|---|
14 | 06/06, 2023 07:14:25 GMT+0200 | + | + | + | - | + | + |
Below, we summarize the date time feed checked above in a single table under your current browser.
# | PHP DateTime->format | js new Date() Feed | js new Date() outputs |
---|---|---|---|
0 | M d, Y H:i:s \G\M\TO | Jun 06, 2023 07:14:25 GMT+0200 | |
1 | M d Y H:i:s \G\M\TO | Jun 06 2023 07:14:25 GMT+0200 | |
2 | Jun 06, 2023 07:14:25 GMT+2 | ||
3 | Y-m-d H:i:s \G\M\TO | 2023-06-06 07:14:25 GMT+0200 | |
4 | Y-m-d H:i:s \G\M\TP | 2023-06-06 07:14:25 GMT+02:00 | |
5 | 2023-06-06 07:14:25 GMT+200 | ||
6 | d M Y H:i:s \G\M\TP | 06 Jun 2023 07:14:25+02:00 | |
7 | Jun 06 2023 07:14:25 GMT+2:00 | ||
8 | M d Y H:i:s \G\M\TP | Jun 06, 2023 07:14:25 GMT+02:00 | |
9 | 2023-06-06 07:14:25 GMT+2 | ||
10 | Y-m-d H:i:s | 2023-06-06 07:14:25 | |
11 | c | 2023-06-06T07:14:25+02:00 | |
12 | Y-m-d H:i:sP | 2023-06-06 07:14:25+02:00 | |
13 | m-d-Y H:i:s\G\M\TO | 06-06-2023 07:14:25 GMT+0200 | |
14 | m/d, Y H:i:s\G\M\TO | 06/06, 2023 07:14:25 GMT+0200 | |
15 | d-M-Y H:i:s \G\M\TO | 06-Jun-2023 07:14:25 GMT+0200 |
Here the column "PHP DateTime->format" gives the format string to be used to obtain the "js new Date() Feed" column for JavaScript Date Constructor. The last column "js new Date() outputs" is JavaScript running results given by new Date(Date-Time String):
<script type="text/javascript"> document.write(new Date("Jun 06, 2023 07:14:25 GMT+0200")); </script>