Skip to Content Skip to Menu

[#2921] Incorrect date/time

  • apdt
  • apdt
  • OFFLINE
  • Posts: 92
  • Thanks: 2
  • Karma: 3
13 years 2 weeks ago - 13 years 2 weeks ago #180063 by apdt
[#2921] Incorrect date/time was created by apdt
It looks to me that Joomla and CBSubs are using different ways of showing the date/time. Both the server and myself are located in Australia so our timezone is the same, UTC +11. Here is what I found in my test.

Server time: Thu, 20 Oct 11 20:00:45 +1100
Site > Global Configuration > Locale Settings > Time Zone: UTC +11

Since we are on the same timezone, I set Joomla's timezone to UTC +11. When I hover on the Time Zone label, it shows the correct date & time. So Joomla should be set correctly.

I created an article and check the published date.
Content > Article Manager > [hover on Published]: 20-Oct-2011 20:01 - Correct

Then I created new user from the front end and check the dates in backend panel.
Actual registration date: 20-Oct-2011 20:02

User Management > Registration Date: 20-Oct-2011 20:02 - Correct

Baskets > Initiated on: 21-Oct-2011 07:02 - 11 hours ahead
Baskets > Completed on: 21-Oct-2011 03:00 - 7 hours ahead
I have no idea where CBSubs get the time since the actual time I set the basket as 'paid' was 20-Oct-2011 20:09 and I select 20-Oct-2011 as the payment date from the pop-up calendar.

Subscriptions > Subscription date: 21-Oct-2011 07:02 - 11 hours ahead
Subscriptions > Last renewal date: 21-Oct-2011 07:02 - 11 hours ahead

So everything that is handled by Joomla is correct (registration, article timestamp), while all CBSubs dates are 11 hour ahead.

If I change Global Configuration's Time Zone to UTC +0 (assuming I have to input my local time offset from the server which is 0), registration date and article timestamps are wrong while CBSubs displays the right time.

So ... how do I make ALL date/time correct?
Last edit: 13 years 2 weeks ago by krileon.

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

  • apdt
  • apdt
  • OFFLINE
  • Posts: 92
  • Thanks: 2
  • Karma: 3
13 years 2 weeks ago #180091 by apdt
Replied by apdt on topic Re: Incorrect date/time
I played around with the Time Zone setting in Global Configuration.

Both Joomla & CBSubs use the Global Config time zone to determine the offset from whatever date stored in the database when displaying the date in the backend panel. For example, if the date in the database is 20-Oct-2011 02:00:00 and time zone is set to UTC +11, date is displayed as 20-Oct-2011 13:00:00.

However, Joomla always converts dates to UTC before storing in the database. It doesn't matter what I set in the Global Config, so I believe Joomla takes the server time (also UTC +11) and convert it to UTC. Before displaying the date, it will add the offset and show the correct date since the offset is also relative to UTC time.

CBSubs, on the other hand, stores dates in server time but also adds the offset when displaying dates. In my case, server time is already UTC +11 so when I set Global Config time zone to UTC +11 all CBSubs date is 11 hours ahead.

One more thing, the date of payment basket's Initiated On is way off and I still can't figure out where CBSubs get the date from.
The following user(s) said Thank You: krileon

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8282
  • Karma: 1443
13 years 2 weeks ago - 13 years 2 weeks ago #180094 by krileon
Replied by krileon on topic Re: Incorrect date/time
This looks like a bug in CBSubs it self. I'm suspecting it's trying to remove the offset then store to database then add the offset on display, but it's just not working out correctly. We do the same thing for UddeIM PMs and I see the same results reported as you're experiencing with CBSubs. I've created a bug ticket for further investigate. I believe the issue is primarily display related and is likely stored to database fine.

#2921

UPDATE: Thank you for your findings as this will be of great help in review of the possible bug.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
Last edit: 13 years 2 weeks ago by krileon.

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

  • apdt
  • apdt
  • OFFLINE
  • Posts: 92
  • Thanks: 2
  • Karma: 3
13 years 2 weeks ago #180095 by apdt
Replied by apdt on topic Re: Incorrect date/time
Hi Kyle :cheer:

krileon wrote: I believe the issue is primarily display related and is likely stored to database fine.


I think the problem is when CBSubs stores the dates. The following dates should be about the same as the records are created at the same time (maybe few seconds difference):

jos_users.registerDate
jos_cbsubs_subscriptions.subscription_date
jos_cbsubs_subscriptions.last_renewed_date

But when I check the database tables, registerDate is UTC time while subscription_date, last_renewed_date (and basket's dates) are all in server time.
The following user(s) said Thank You: krileon

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48478
  • Thanks: 8282
  • Karma: 1443
13 years 2 weeks ago #180116 by krileon
Replied by krileon on topic Re: Incorrect date/time
I see, thank you for your findings. We'll have to investigate source to see how CBSubs is handling dates. Please do let us know if you find any further information regarding this issue as is greatly appreciated.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

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

  • GUEST
10 years 7 months ago #243104 by
Replied by on topic Re: Incorrect date/time
I know this is an old thread, but it's still ranking well so hopefully I can add a solution to help others facing the same problem. I experienced the exact same situation. The dates in our database were correct, but when displayed in the administration section they were being adjusted/adapted when they didn't need to be. I made the following changes:

components/com_comprofiler/plugin/user/plug_cbpaidsubscriptions/libraries/cbpaidViewExtended.php

Change this in function _form_datetime:
Code:
$adaptTimeZone = ( $node->attributes( 'timezone' ) == 'RAW' ) ? 0 : 1;

To this:
Code:
$adaptTimeZone = ( empty($node->attributes( 'timezone' )) || $node->attributes( 'timezone' ) == 'RAW' ) ? 0 : 1;

Why?

When setting the
Code:
$adaptTimeZone
flag, the function was checking the value of
Code:
$node->attributes( 'timezone' )
, which in our case wasn't set to anything. If you don't know the timezone, how can you know whether to adjust it? If it's not set, we are choosing to take the value for what it is and not offset it in any way.

administrator/components/com_comprofiler/comprofiler.class.php

Change this in function cbFormatDate:
Code:
$date = substr( $date, 0, 10 );

To this:
Code:
$date = _old_cbFormatDate( $date, (($showtime) ? "%Y-%m-%d %H:%M:%S" : "%Y-%m-%d" ), 0);

Why?

Only date values being offset were showing the time portion. This change means non-offset dates can also show the time component as well, if requested.

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

Moderators: beatnantkrileon
Powered by Kunena Forum