Keyword

Style css when an item from a category is written today

  • Slartibartfast
  • Slartibartfast's Avatar Topic Author
  • Offline
  • Junior Member
More
6 years 2 months ago #168972 by Slartibartfast
Replied by Slartibartfast on topic Style css when an item from a category is written today
this is solved but i can't post my answer here... clicking submit takes me back to editor. no messages

Please Log in or Create an account to join the conversation.

More
6 years 2 months ago #168980 by JoomlaWorks
You can use GitHub's Gist (gist.github.com) or any other similar service to paste your code and then simply add a link back here.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.

  • Slartibartfast
  • Slartibartfast's Avatar Topic Author
  • Offline
  • Junior Member
More
6 years 2 months ago - 6 years 2 months ago #168985 by Slartibartfast
Replied by Slartibartfast on topic Style css when an item from a category is written today
ok. got excellent help at stack exchange and here is the solution - also posted here*

Specs: Centos 7.5, MariaDB 5.5, plesk 17.8

we need to load the timezones to mysql. (used this excellent post*)

i run
SELECT CONVERT_TZ('2012-06-07 12:00:00', 'GMT', 'America/New_York');
and it returned null. this means time zones are not loaded.

so i logged with ssh and give
mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u admin -p`cat /etc/psa/.psa.shadow` mysql

remember this is a plesk installation. use "-u root" and your mysql password if not plesk.
you may get 2 warnings
Warning: Unable to load '/usr/share/zoneinfo/leapseconds' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/tzdata.zi' as time zone. Skipping it.

based on this* you are good to go.

now zones are loaded. you can run the previous query to test it.

and now we can use mick's query to convert the timezone properly.
$query->where("DATE(CONVERT_TZ(publish_up, 'GMT', 'Europe/Athens')) = DATE(CONVERT_TZ(NOW(), 'GMT', 'Europe/Athens'))");

@Fotis thank you for your help! using JDate, i think i tried it in the past. i couldn't come with any solution. if you have any suggestions i could happily try them.

*unfortunately links are not accepted by the editor so i had to delete them
Last edit: 6 years 2 months ago by Slartibartfast.

Please Log in or Create an account to join the conversation.

More
6 years 2 months ago #168991 by JoomlaWorks
Well, if it works for you, that's great. I didn't even know you can modify these 2 files under /usr/share/zoneinfo/ to adjust the timezone offset.

Using JDate, I would leave all dates as UTC, compare them as UTC and simply offset the results based on JDate to the user.

Fotis / JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)

Please Log in or Create an account to join the conversation.


Powered by Kunena Forum