-1

I've to extrapolate from a numeric string a date composed by month and year only. E.g: A string like this:

201611

has to become:

2016-11

Then, I've to store this date in a fild of db that is a datetime. Can you help me, please? Thanks!

luca
  • 55
  • 2
  • 8

1 Answers1

0
$new_date = substr_replace($old_date, '-', 4, 0);
airdrumz
  • 429
  • 4
  • 9