Date question

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

By shawnpatoka - December 3, 2012

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

By gregThomas - December 3, 2012

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

By shawnpatoka - December 3, 2012

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: [shawnpatoka] Date question

By gregThomas - December 3, 2012

Hi,

I've just done some testing and you can import date data from a CSV into a date field. But the text format of the date in the CSV has to be in MySQL date structure, which is: YYYY-MM-DD HH:MM.

Thanks
Greg Thomas







PHP Programmer - interactivetools.com