Skip to Content Skip to Menu

🎃 Happy Halloween! Treat yourself with an awesome discount on memberships! Get 20% off now with code SPOOKY-2024!

cb article tab php for date

  • jpdenny1
  • jpdenny1
  • OFFLINE
  • Posts: 195
  • Thanks: 25
  • Karma: 5
8 years 10 months ago #275602 by jpdenny1
cb article tab php for date was created by jpdenny1
Just a quick question regarding the tab.php (mytemplate)for cb articles. I want to take out the time. My date format in configuration is dd/mm/yyyy. Shows like dd/mm/yyy 21:23 for articles list.

Line 73:

'<td style="width: 25%;" class="text-left hidden-xs">' . cbFormatDate( $row->get( 'created' ) ) . '</td>'.'</tr>';

Do I just splice in:

d.m.Y or d/m/Y somewhere?

Bit conscious of not breaking anything. If I can do as above where would I insert it.

Kind regards

Joomla 3.6.2
CB 2.0.15 Latest Nightly
GJ 3.0.1 nightly
Php version 5.5.35
Auto actions nightly
Activity nightly
Privacy nightly
Conditions nightly
CB Gallery 2.0
.....all nightly!
Uddeim 3.9

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48464
  • Thanks: 8280
  • Karma: 1443
8 years 10 months ago #275629 by krileon
Replied by krileon on topic cb article tab php for date
See the below phpdoc for cbFormatDate. You can completely override the format using it. The formatting supplied needs to be PHP date function compatible.

Code:
/** * Offsets date-time if time is present and $serverTimeOffset 1, then formats to CB's configured date-time format. * * @param int|string $date In "Y-m-d H:i:s" format, or int : unix timestamp * @param boolean $serverTimeOffset False: don't offset, true: offset if time also in $date * @param bool|string $showTime False don't show time even if time is present in string, timeago: show jquery timeago * @param null|string $dateFormatOverride Format override for date display * @param null|string $timeFormatOverride Format override for time display * @param null|string|int $offsetOverride Offset override for time display * @return null|string */ function cbFormatDate( $date, $serverTimeOffset = true, $showTime = true, $dateFormatOverride = null, $timeFormatOverride = null, $offsetOverride = null ) {


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.

  • jpdenny1
  • jpdenny1
  • OFFLINE
  • Posts: 195
  • Thanks: 25
  • Karma: 5
8 years 10 months ago - 8 years 10 months ago #275668 by jpdenny1
Replied by jpdenny1 on topic cb article tab php for date
Thanks Kyle, I'll have to do a bit of reading upon that at some point or get someone to refer back to this in future, as it's over my head. I customized my K2 layout with PHP but that was more moving stuff around and deleting.

Just another question on time if you don't mind. My site will be globally used by registered users. I have tested the timezone parameter - setting it to foreign time zones with no apparent difference occuring. It sticks with the Joomla timezone for e.g. posts etc and notification emails I think.

Am I missing something with this?What is it suppose to do (didn't see anything in Primer Book). Wonder does it have something to do with the phpdoc you supplied.

Kind regards

Joomla 3.6.2
CB 2.0.15 Latest Nightly
GJ 3.0.1 nightly
Php version 5.5.35
Auto actions nightly
Activity nightly
Privacy nightly
Conditions nightly
CB Gallery 2.0
.....all nightly!
Uddeim 3.9
Last edit: 8 years 10 months ago by jpdenny1.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48464
  • Thanks: 8280
  • Karma: 1443
8 years 10 months ago #275669 by krileon
Replied by krileon on topic cb article tab php for date
What timezone did you adjust? The one in Joomla global configuration or the one specifically for your user? CB always stores date and datetime as UTC and then offsets for display only so you can change the timezone at anytime to offset appropriately.


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.

  • jpdenny1
  • jpdenny1
  • OFFLINE
  • Posts: 195
  • Thanks: 25
  • Karma: 5
8 years 10 months ago - 8 years 10 months ago #275671 by jpdenny1
Replied by jpdenny1 on topic cb article tab php for date
Hello. The one in parameters tab. At individual user level. (also has language etc in there).

So if someone sets it to Beijing time and they post/upload etc, their local time should appear for display only e.g cb blog, activity post etc. I thought that was what should happen.

Doesn't work for me but I will try again.

Kind regards

Edit: It does work my apologies. Was referring to a previous test I did, had older versions.
Still though for CB blogs for example the time says 03.57 for Havanna which should be PM. Better if the time was out altogether.
Ha. Edit: had it on 12 hour in CB.

So I've been thinking, your phpdoc shows how to adjust the time. Using the timezone parameter, the user sets this (the offset) themselves. But I was looking to take it out of the display. Actually for both CB Blogs and CB Articles in Userprofile view.

Joomla 3.6.2
CB 2.0.15 Latest Nightly
GJ 3.0.1 nightly
Php version 5.5.35
Auto actions nightly
Activity nightly
Privacy nightly
Conditions nightly
CB Gallery 2.0
.....all nightly!
Uddeim 3.9
Last edit: 8 years 10 months ago by jpdenny1.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48464
  • Thanks: 8280
  • Karma: 1443
8 years 10 months ago #275683 by krileon
Replied by krileon on topic cb article tab php for date
Date and datetime are always UTC offset by whatever timezone the viewing user has set in their account or the server timezone if they don't have a timezone set. You will not see entries in the timezone of the displayed user.

If you don't want to offset at all then set $serverTimeOffset to false. It's the second variable of cbFormatDate.


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