Jump to content

[SOLVED] Not able to alter column with timestamp to only YYYY-MM-DD


Recommended Posts

Hi  ;)

 

I am trying to find a solution on how to fetch all unique dates from a timestamp (YY-MM-DD-HH-MM-SS). Since HH-MM-SS is included i get a lot of rows from the same date. I would like to do this so i can calculate the sum between the dates .Currently i am using between curdate() and interval 1 day but my plan is to use it in a for loop between the first entry date and the second one (even if they are separated by three days for instance)

 

Of course i could write code to loop through the array and try to sort out unique dates from there but i would prefer to fetch them directly with a SQL query or alter the table and column so the timestamp only show 8 digits..but haven't had any luck.

 

 

My second guess is doing a select statement and save it as and then somehow use DATE(timestamp) on all rows.

 

Any ideas?

 

Thanks  :)

 

 

 

 

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.