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:
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!
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
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?
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
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
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
PHP Programmer - interactivetools.com