MySQL Date & Time functionsMySQL have several date & time related functions to use in different situations and requirements. We will discuss some of the important functions here and use them for developing some sample codes. You can read php date & time functions.
From Date of Birth Calculate the retirement dateThe person will retire on the last working day of the retirement month.Group by in date field to count records of each dayGetting records of each day by using group by and count command in mysql date fieldData of different quarters of the yearDifferent Financial Quarter dataFormat to use for creating date string before storing in Date field.Date fields of MySQL table accept a particular format of Date & time strings, so we have to create such an acceptable format while storing Date values.Collecting date stored as string in varchar field.We can use str_to_date function to format date value stored as string in a varchar field ( not date field )Adding present date & time automatically to mysql tableWe can store the present date & time in a DateTime field while updating adding a record by using default value to CURRENT_TIMESTAMPFormatting returned date value using strtotime functionWe can format the returned date value from table by using strtotime function.Subscribe to our YouTube Channel here
This article is written by plus2net.com team.
https://www.plus2net.com
![]() ▼ More on Date & Time functions in SQL | ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||