MySQL Query to Select All and Convert Date -


how write query in mysql select , convert 2 unix date columns readable, i.e. - from_unixtime(received_date) without needing manually write out each of other column names in select statement?

you can use

select *, from_unixtime(received_date), from_unixtime(other_date_field) table; 

you have 2 date columns shown in both time stamp , readable formats in result. might want use rename readable columns so:

select *, from_unixtime(received_date) date1, from_unixtime(other_date_field) date2 table; 

note wild card has come first:

select *, field from... 

you'll error if select field, * from...

i hope helps.


Comments

Popular posts from this blog

OpenCV OpenCL: Convert Mat to Bitmap in JNI Layer for Android -

android - org.xmlpull.v1.XmlPullParserException: expected: START_TAG {http://schemas.xmlsoap.org/soap/envelope/}Envelope -

python - How to remove the Xframe Options header in django? -