Skip to Content Skip to Menu

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

Change date format for display

  • Burnardo
  • Burnardo
  • OFFLINE
  • Posts: 39
  • Thanks: 9
  • Karma: 0
8 years 7 months ago #279736 by Burnardo
Change date format for display was created by Burnardo
Hi,

Although there are quite a number or remarks and comments (and a nice video tutorial, nr 8) I still am not able to change the way a date and time are displayed to my preference.

The field-name that I am trying to show is: "lastvisitDate". This is a system-field-name.

This field is selected in a list that I am showing to logged-in visitors. In the list this value is nicely shown and has the correct value.
Only thing I would like to change is the format of the date and time that are shown.

So, in the Field Management, I open this field "lastvisitDate", and add some code in order to format the "Userlist Value Layout".
Here is the code I use (which is not succesful):

[cb:userdata field="lastvisitDate" format="d M Y, H:i" /]

Can you show me the correct code, I would have to use to achieve this. As I said, the value is shown, but the formatting of the date-time is not picked up by this code.

Thanks for your time,
Burnardo

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48460
  • Thanks: 8280
  • Karma: 1443
8 years 7 months ago #279776 by krileon
Replied by krileon on topic Change date format for display
There's no substitution to reformat a field like that. To change the format of a date or datetime field you need to edit that field within CB > Field Management. Next under Parameters > Display set "Profile View Display" to "Custom". You can now supply a custom date (and time if the field supports time) format specifically for that field.


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.

  • Burnardo
  • Burnardo
  • OFFLINE
  • Posts: 39
  • Thanks: 9
  • Karma: 0
8 years 7 months ago #279779 by Burnardo
Replied by Burnardo on topic Change date format for display
Great...,

Already executed as suggested. Now feeling embarrassed that I missed this...

Thanks Kyle,
Burnardo

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

  • Burnardo
  • Burnardo
  • OFFLINE
  • Posts: 39
  • Thanks: 9
  • Karma: 0
8 years 7 months ago - 8 years 7 months ago #279794 by Burnardo
Replied by Burnardo on topic Change date format for display
Allas, still having a problem with the date format.

Now it seems that the custom format is nicely followed (in the sense of using day and month format) but the used language is not dutch (set as default language for the website) but english.

Even after inserting all the day and month names in the language-override files, it still does not respect the language request.

How can I solve this?

Thanks for your time,
Burnardo
Last edit: 8 years 7 months ago by Burnardo.

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

  • Burnardo
  • Burnardo
  • OFFLINE
  • Posts: 39
  • Thanks: 9
  • Karma: 0
8 years 7 months ago - 8 years 7 months ago #279819 by Burnardo
Replied by Burnardo on topic Change date format for display
Found a working solution...

(for the translation part...) It appears that the "short month" notation translates well, so I will be using that, instead of the longer month name.

Apparently there is still some file where the wrong (long month) date names are coming from. And, although I am using the language override plugin with correctly inserted long month names, there still is some sneaky whereby the wrong (english) names are being pulled in.

But I will leave it at this for the time being.
Regards,
Burnardo
Last edit: 8 years 7 months ago by Burnardo.

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

  • krileon
  • krileon
  • ONLINE
  • Posts: 48460
  • Thanks: 8280
  • Karma: 1443
8 years 7 months ago - 8 years 7 months ago #279837 by krileon
Replied by krileon on topic Change date format for display
You should be able to translate the full length names using the below language strings.

Code:
'UE_WEEKDAYS_1' => 'Sunday', 'UE_WEEKDAYS_2' => 'Monday', 'UE_WEEKDAYS_3' => 'Tuesday', 'UE_WEEKDAYS_4' => 'Wednesday', 'UE_WEEKDAYS_5' => 'Thursday', 'UE_WEEKDAYS_6' => 'Friday', 'UE_WEEKDAYS_7' => 'Saturday',

This assumes nothing is overriding them after you've translated them.


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: 8 years 7 months ago by krileon.

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

Moderators: beatnantkrileon
Powered by Kunena Forum