I have the date in the form Sat Aug 08 2015 00:00:00 GMT+0530
(India Standard Time). How can I get the date of the format "yyyy/mm/dd".
Asked
Active
Viewed 775 times
-1

AddWeb Solution Pvt Ltd
- 21,025
- 5
- 26
- 57

akshara
- 9
- 6
-
use date function of php – aldrin27 Aug 13 '15 at 05:08
-
try this : - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS"); – Ankur Tiwari Aug 13 '15 at 05:11
1 Answers
0
Try this:
echo date('Y/m/d', strtotime('Sat Aug 08 2015 00:00:00 GMT+0530') );

angelcool.net
- 2,505
- 1
- 24
- 26
-
its everytime giving 1970-01-01. I am not able to get a correct date. My date is in a variable $var. $var="Sat Aug 08 2015 00:00:00 GMT+0530" so i fetch it as $date=date('y-m-d',strtotime($var)); //1970-01-01 – akshara Aug 13 '15 at 06:25