Convert timestamp to Date readable format in MySQL query

SQL query to convert timestamp to date readable format, which is stored in MySQL database.

SELECT t.*, DATE_FORMAT(FROM_UNIXTIME(t.enteredOn), ‘%e %b %Y’) AS formated_date FROM tbl_sample AS t;

For the detailed reference on DATE_FORMAT() and FROM_UNIXTIME()

Read More

Get Date value based on User Locale – Zend PHP

Use the code given below to get the date value in desired format based on user locale using Zend_Date() & Zend_Locale().


Read More

Get date value using day name and week number of a month php

Here,  i’m going to explain one of the most powerful functions of PHP. Suppose if we want to get the date value using day name (like Sunday, Monday etc… ) and week number (like First, Second, Third etc..), use PHP strftime() function. This function has some crazy behavior. See the example given below:

Like this, try other patterns also. For more info about strftime() function refer here. To know about PHP date relative formats, click here.

Read More