X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Changing design (https://forum.x-cart.com/forumdisplay.php?f=51)
-   -   PHP/MySQL date question (https://forum.x-cart.com/showthread.php?t=1128)

ryan 01-07-2003 01:46 PM

PHP/MySQL date question
 
I am trying to add a page to my site that will show all titles with a release date greater than a certain date. This date is stored in the table as a string in just a regular date format (ie "01/02/2003"). Is there anyway to do what I want to do with the date in this format or am I going to have to convert all my dates to a timestamp?

thanks
Ryan

funkydunk 01-07-2003 10:47 PM

Hi Ryan,

Not quite on the subject but this was put together last week .. http://forum.x-cart.com/viewtopic.php?t=1418&highlight=

Is the release date an extra field?

If it is and you are wanting to compare it you can dissect parts of the string using PHP on the basis

$day = substr($your_field,0,2) where the 0 is the start point (the first position is always 0 not 1) in the string and the 2 is the length.

Therefore:
$month=substr($your_field,3,2)
and
$year=substr($your_field,5,4)

ryan 01-08-2003 06:58 AM

Can that be done in the SQL statement though? I don't want to bring back all records and then only display the ones which meet the criteria. That would be way to slow (we currently have around 10000 items on the site). I thinking I might have to convert all my dates to a timestamp, but that sounds annoying.

thanks


All times are GMT -8. The time now is 08:56 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.