Jump to content

Recommended Posts

I have a MySQL database table with a field that is of type TIMESTAMP(12). When I do a query, I get the result back as YYYYMMDDHHMM as expected. The syntex of my query is \"SELECT * FROM rv\". I am obviously using PHP and I am trying to take the result and split it up into 2 arrays, one for date and one for time (ie. $date == $date[0]=YYYY, $date[1]=MM, $date[2]=DD and $time == $time[0]=HH, $time[1]=mm). WHat is the easiest way to accomplish this?

 

I have also thought about trying to get the info from within my query, BUT I am using \"SELECT *\" and have not found a way to use \" * \" and request specific formated dates or times. I would rather stick with selecting \" * \" instead of spelling it all out in the query b/c there are 20+ fields of info that I need.

 

Thanks in advance for the help!

Link to comment
https://forums.phpfreaks.com/topic/1515-datetimestamp-question/
Share on other sites

Try something like:

 

SELECT *, DATE(ts) as tsdate, TIME(ts) as tstime FROM table

 

I just tried this and it didn\'t work.

 

This is the SQL query that I am using: SELECT *, DATE(rv_arrive) as arrive_date, TIME(rv_arrive) as arrive_time FROM rt_rv WHERE rv_key=1001

Link to comment
https://forums.phpfreaks.com/topic/1515-datetimestamp-question/#findComment-4981
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.