Hi
Am building an invoicing system in a small sporting associations website.
Have this query, it works fine.
SELECT date_format( inv_date, '%b %e, %Y' ) AS issuedate, DATE_ADD( inv_date, INTERVAL 14 DAY ) AS duedate, inv_id, inv_date
FROM inv_to
inv_date is a DATE column in the table.
What I would like to do is put these 2 parts of the query together so I have a "Due Date" 14 days after the "Issue Date" that is reformatted
"date_format( inv_date, '%b %e, %Y' ) --------DATE_ADD( inv_date, INTERVAL 14 DAY ) AS duedate
Hope this makes sense.
As always, thanks in advance for any assistance you can offer
Query using date_add and date_format
Moderator: General Moderators
Re: Query using date_add and date_format
It already is 14 days after the inv_date. Are you asking about getting it formatted the same way? Then use DATE_FORMAT in the same way (except inv_date is replaced with the DATE_ADD you have there now).Alpal wrote:What I would like to do is put these 2 parts of the query together so I have a "Due Date" 14 days after the "Issue Date" that is reformatted
Re: Query using date_add and date_format
Thanks
That is what I want to do but do not know how to put it all together
That is what I want to do but do not know how to put it all together
Re: Query using date_add and date_format
Resolved the problem using php
<?php $newDate = date("M d, Y", strtotime($row_inv_pay['duedate'])); echo $newDate; ?>
Obviously I use dreamweaver - the recordset name is inv_pay
Would have preferred to do it in the query though if anyone can assist would appreciate.
<?php $newDate = date("M d, Y", strtotime($row_inv_pay['duedate'])); echo $newDate; ?>
Obviously I use dreamweaver - the recordset name is inv_pay
Would have preferred to do it in the query though if anyone can assist would appreciate.