When I try to insert date like 20-jan-50 by changing
date("d-m-Y", strtotime($date))
It stores like 20-01-2050. But the actual date was 20-01-1950. After 1980 stores perfect.Like 20-jan-89 was stored as 20-01-1989.
When I try to insert date like 20-jan-50 by changing
date("d-m-Y", strtotime($date))
It stores like 20-01-2050. But the actual date was 20-01-1950. After 1980 stores perfect.Like 20-jan-89 was stored as 20-01-1989.
You need to check Docs. It is clearly noted within that if number of year is specified in a two digit format, the values between 00-69 are mapped to 2000-2069 and 70-99 to 1970-1999
Note: If the number of the year is specified in a two digit format, the values between
00-69are mapped to2000-2069and70-99to1970-1999. See the notes below for possible differences on32bitsystems (possible dates might end on2038-01-19 03:14:07).
<?php
$date="20-jan-50";
$a=date("d-m-y", strtotime($date));
echo $a;
?>
write this code.i hope this work.
you date format is not compatible with strtotime you must use: Year, month and day:
$date = '2050-01-20';
date("Y-m-d", strtotime($date));