Skip to content
Advertisement

Tag: date-formatting

how to get month name from month-year (08-2022) string in php

how to get month name from month-year (08-2022) string in php i want to get this Aug-2022 (format) from my value 08-2022 I had tried date(‘m-Y’,strtotime(08-2022)) and date(’08-2022′)->format(‘m-Y’) but not working. Answer Just put a “01-” in front of your value to make it a valid date. try self: https://3v4l.org/ZiB70 or with DateTime: Important NOTE: That ! in the format

Advertisement