Date question

5 posts by 2 authors in: Forums > CMS Builder
Last Post: December 4, 2012   (RSS)

I want to display a list of results that all have dates. Is it possible to only display results of the current days date and later?

Re: [shawnpatoka] Date question

Hi,

If your using a date time field to store your dates then the easiest way to to it in a getRecords function is like this:

// load records from 'blog'
list($blogRecords, $blogMetaData) = getRecords(array(
'tableName' => 'blog',
'allowSearch' => false,
'where' => 'date > CURDATE()'
));


So the CURDATE function in the where statement for this getRecords function will only return articles that are newer than the current date and time.

Let me know if this isn't what you're looking for.

Thanks!
Greg Thomas







PHP Programmer - interactivetools.com

Re: [greg] Date question

I ended up using the date as a regular field because of the CSV Import.

I have a big list of stuff in a CSV that i wanted to import and then sort by date. Is there a way I can use that CSV Import Plugin to import a date from the CSV in as a actual date field?

Re: [greg] Date question

excellent, thank you!