How would I display a general 'last updated' date?
3 posts by 2 authors in: Forums > CMS Builder
Last Post: March 3, 2010 (RSS)
Hello :)
Is it possible to get a date from the database to use as a 'last updated' date for all results as a whole?
CMSB is cleared and populated each night (if there is a new data file), and I would like to be able to show the date that the update last happened.
I was thinking I could get the date from the last record to be added, but not having much luck! Any suggestions are welcome :)
Many thanks in advance
8BG
Is it possible to get a date from the database to use as a 'last updated' date for all results as a whole?
CMSB is cleared and populated each night (if there is a new data file), and I would like to be able to show the date that the update last happened.
I was thinking I could get the date from the last record to be added, but not having much luck! Any suggestions are welcome :)
Many thanks in advance
8BG
Re: [8bit Gamer] How would I display a general 'last updated' date?
By Chris - February 15, 2010
Hi 8bit Gamer,
If you're running a script every night to clear and populate the data, you might consider having that script also write out the current date/time to a file, then including that file to get the "last updated" date.
Alternately, you could use a MySQL query to get the latest "updatedDate" field for a table (e.g. SELECT MAX(updatedDate) FROM cms_tablename). This approach would be could be somewhat slow. Please let me know if you want more information on this approach.
I hope this helps! Please let me know if you have any questions.
If you're running a script every night to clear and populate the data, you might consider having that script also write out the current date/time to a file, then including that file to get the "last updated" date.
Alternately, you could use a MySQL query to get the latest "updatedDate" field for a table (e.g. SELECT MAX(updatedDate) FROM cms_tablename). This approach would be could be somewhat slow. Please let me know if you want more information on this approach.
I hope this helps! Please let me know if you have any questions.
All the best,
Chris
Chris
Re: [chris] How would I display a general 'last updated' date?
Good idea. I will try that!
Thanks :)
Thanks :)