How to display date in local format in blog?

All WYSIWYG Web Builder support issues that are not covered in the forums below.
Forum rules
IMPORTANT NOTE!!

DO YOU HAVE A QUESTION OR PROBLEM AND WANT QUICK HELP?
THEN PLEASE SHARE A "DEMO" PROJECT.



PLEASE READ THE FORUM RULES BEFORE YOU POST:
http://www.wysiwygwebbuilder.com/forum/viewtopic.php?f=12&t=1901

MUST READ:
http://www.wysiwygwebbuilder.com/getting_started.html
WYSIWYG Web Builder FAQ
Post Reply
bzc0fq@gmail.com
 
 
Posts: 30
Joined: Sat Feb 26, 2022 3:46 pm

How to display date in local format in blog?

Post by bzc0fq@gmail.com »

Hi,

Could you please advise on how to display Blog's date in local format (Polish)?
To be more specific I would like to display a date in long format in Polish "środa, 21 sierpnia 2024" Polska ‎(UTC+2)‎

Many thanks for helping!

Best Regards :)
User avatar
Pablo
 
Posts: 23252
Joined: Sun Mar 28, 2004 12:00 pm
Location: Europe
Contact:

Re: How to display date in local format in blog?

Post by Pablo »

You can set the date format in the properties of the blog.
However, the format you are requesting is currently not supported.
bzc0fq@gmail.com
 
 
Posts: 30
Joined: Sat Feb 26, 2022 3:46 pm

Re: How to display date in local format in blog?

Post by bzc0fq@gmail.com »

I see..., I will manage this in other way then...
anyway thanks for the information.

Best Regards
bzc0fq@gmail.com
 
 
Posts: 30
Joined: Sat Feb 26, 2022 3:46 pm

Re: How to display date in local format in blog?

Post by bzc0fq@gmail.com »

Hi Pablo,

I wrote a javascript in order to convert $DATE$ from a layout file into Polish long date format.
Here is the code:

Code: Select all

<div class="blogitem">
   <$HEADING$ class="blogsubject">$SUBJECT$</$HEADING$>
   <p class="blogdate">
      [b]<script type="text/javascript">document.write(date2polish('$DATE$'))</script>[/b]
   </p>
   <p class="blogthumb">$IMAGE$</p>
   $TEXT$
   <a class="blogbutton" href="$URL$" target="$TARGET$">$BUTTONTEXT$</a>
   <p><span class="blogcomments">$LABEL$ <a style="color: black;" href="mailto:$EMAIL$?subject=$SUBJECT$">$EMAIL$</a></span> </p>
</div>

Code: Select all

DayT = new Array(7) 
DayT[0] = "niedziela" 
DayT[1] = "poniedziałek" 
DayT[2] = "wtorek" 
DayT[3] = "środa" 
DayT[4] = "czwartek" 
DayT[5] = "piątek" 
DayT[6] = "sobota"

MonthT = new Array(12) 
MonthT[0] = "stycznia" 
MonthT[1] = "lutego" 
MonthT[2] = "marca" 
MonthT[3] = "kwietnia" 
MonthT[4] = "maja" 
MonthT[5] = "czerwca" 
MonthT[6] = "lipca" 
MonthT[7] = "sierpnia" 
MonthT[8] = "września" 
MonthT[9] = "października" 
MonthT[10] = "listopada" 
MonthT[11] = "grudnia"

function date2polish(dateT){
	var tEMP = new Date(dateT);
	var Day = tEMP.getDate();
	var DayOW = tEMP.getDay();
	var Month = tEMP.getMonth(); 
 	var Year = tEMP.getFullYear();

	return DayT[DayOW] + " , " + Day + " " + MonthT[Month] + " , " + Year;
}
It works fine with date in mm/dd/YYYY format.
Post Reply