Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 285
  • Last Modified:

digit gmt+ date

I get date in this format

16.11.2010
13:53:40 GMT+01:00

want
2010-11-16
0
rgb192
Asked:
rgb192
  • 2
2 Solutions
 
Ali KayahanFull Stack DeveloperCommented:
echo date("Y-m-d",strtotime("16.11.2010 13:53:40 GMT+01:00")) ;
0
 
Ray PaseurCommented:
Same answer as the other:
http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/PHP/A_201-Handling-date-and-time-in-PHP-and-MySQL.html

date('Y-m-d') will format it correctly.  Not sure if strtotime() can handle that - you can test the strings on my web site here:
http://www.laprbass.com/RAY_strtotime.php
0
 
Ray PaseurCommented:
It tests OK with strtotime()
16.11.2010 13:53:40 GMT+01:00 WORKS WITH strtotime()
THE INTEGER TIMESTAMP VALUE IS 1,289,912,020
THE ISO8601 DATETIME STRING IS 2010-11-16T06:53:40-06:00
THE TEXTUAL DATE IS Tuesday 16th of November 2010 6:53:40 AM
0
 
rgb192Author Commented:
$gmtp="16.11.2010 13:53:40 GMT+01:00";
echo date("Y-m-d",strtotime("$gmtp")) ;
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now