Receives a mysql datetime format: date, time, datetime, timestamp, year. Returns formated date/time string based on PHP symbols .
By : trube
/** str FormatMySQLDateTime (mysql time, mysql datetime column type, string format)
Receives a mysql datetime format: date, time, datetime, timestamp, year returns formated date/time string based on PHP symbols
mysql date format: YYYY-MM-DD mysql time format: either HH:MM or HH:MM:SS mysql datetime format: YYYY-MM-DD HH:MM:SS mysql timestamp format: YYYYMMDDHHMMSS mysql year format: YYYY
l (lowercase 'L') - day of the week, textual, long; e.g. "Friday" D - day of the week, textual, 3 letters; e.g. "Fri" F - month, textual, long; e.g. "January" M - month, textual, 3 letters; e.g. "Jan" n - month without leading zeros; i.e. "1" to "12" m - month; i.e. "01" to "12" j - day of the month without leading zeros; i.e. "1" to "31" d - day of the month, 2 digits with leading zeros; i.e. "01" to "31" S - English ordinal suffix for the day of the month, 2 characters; i.e. "st", "nd", "rd" or "th" Y - year, 4 digits; e.g. "1999" y - year, 2 digits; e.g. "99" z - day of the year; i.e. "0" to "365"
a - "am" or "pm" A - "AM" or "PM" g - hour, 12-hour format without leading zeros; i.e. "1" to "12" G - hour, 24-hour format without leading zeros; i.e. "0" to "23" h - hour, 12-hour format; i.e. "01" to "12" H - hour, 24-hour format; i.e. "00" to "23" i - minutes; i.e. "00" to "59" s - seconds; i.e. "00" to "59"
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.