Skip to Content Skip to Menu

[SOLVED] Date & time with time zone showing in the profile

  • ericmuc
  • ericmuc
  • OFFLINE
  • Posts: 390
  • Thanks: 30
  • Karma: 2
  • Add-ons
3 years 10 months ago - 3 years 10 months ago #321874 by ericmuc
Hi,
I would like to show the current date/time regarding the users timezone (from params set in the profile = Joomla field) in the user profiles, so that everyone knows, which time the showing user has (not the viewing user).
My idea is to use a code field and add a code for that.
But I have to look for the right code. I didn't find something in the forum.
Do you have a documentation or a hint for that?
Or do I thinking to complicate and is there a simple solution?
Thanks, best regards
Eric
Last edit: 3 years 10 months ago by krileon. Reason: Added [SOLVED] tag to subject

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48429
  • Thanks: 8274
  • Karma: 1443
3 years 10 months ago #321881 by krileon
Users timezone from the params field is stored in the params column of the _users database table. You should be able to use Joomla API to get the timezone param value. Example as follows.

Code:
return JFactory::getUser( (int) '[user_id]' )->getParam( 'timezone' );


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.

  • ericmuc
  • ericmuc
  • OFFLINE
  • Posts: 390
  • Thanks: 30
  • Karma: 2
  • Add-ons
3 years 10 months ago #321899 by ericmuc
Hi,
Thanks, that is helpful as a first step.
But please let me ask:
Don't you have a full code example to show date and time with using timezone of every user in his cb profile?
Thanks, best regards
Eric

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48429
  • Thanks: 8274
  • Karma: 1443
3 years 10 months ago #321911 by krileon
So you want all date and times displayed on profile to be in the timezone of the displayed user? What would be the purpose of that? Timezone offset is based off who is viewing the content so it's relevant to their timezone. No, we do not have a feature for that.


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.

  • ericmuc
  • ericmuc
  • OFFLINE
  • Posts: 390
  • Thanks: 30
  • Karma: 2
  • Add-ons
3 years 10 months ago #321932 by ericmuc
Hi,
OK, I understand. But I want to add an example for

What would be the purpose of that?

:

In a international site it could be that a user from Europe want to have contact with a user of Australia.

In CB there is already the user feature "online", so that others know whether a user is online. But if a chat system is used (even with pms) the European user shall know the current day time of the correspondence partner. Is is late night in Australia or are normal office hours and culd be a longer conversation be started?

For this I want to add the current date time to the showing profile (I will do this for my own).

Thanks, best regards
Eric

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48429
  • Thanks: 8274
  • Karma: 1443
3 years 10 months ago #321948 by krileon
For fields (e.g. Business Hours field usecase) you'd simply turn off server offset in the datetime or time field parameters, but beyond that there is no option for what you're wanting. It doesn't make sense to display the datetime like you're suggesting for PMS or Chat. If that were the case then for example people would receive messages with future dates and times; it would make no sense.


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.

Moderators: beatnantkrileon
Powered by Kunena Forum