[Date] and time format

Xibo is successfully reading an RSS feed from our website via a ticker. However, I am not able to format the date/time into something a little more easy to read.

In the ticker the tag for the date/times is:
[Date]

This results in something that looks like this:
06/07/17 09:30:00
But this isn’t very nice to look at. It’s better for it to say July 6, 2016 9:30 AM

But I can’t figure out how to make it formatted how I want it. I am not a programmer or someone who understands code. Please keep this in mind when you reply…best to assume that I know nothing.

Thanks in advance.

You could do something ugly like I’ve done.
I’m using a scheduled task that uses cURL to make a copy of the RSS feed, then manipulating it with a perl script.

This is a pretty ugly pretty script but it gets the job done.

require LWP::UserAgent;
use XML::FeedPP;
use Time::Format;
use Date::Manip;

my $source = 'htdocs/sharepoint.rss';
my $feed = XML::FeedPP->new( $source );

# Iterates through several arrays to find items matching "Start", strips date and time 
# Sends date and time from sharepoint Start Time through "ParseDate" from Date::Manip
# Feeds resulting fixed date and time into the current items pubDate

foreach $item ( $feed->get_item() ) {
    $description = $item->description(); # loads RSS item <description> to make an array next
	@splitdesc = split /\<div\>/, $description; #initial split done on div tag
	foreach (@splitdesc){
		@splitelement = split/\<b\>/, $_; # splits each element in that array by <b\> tag
		foreach (@splitelement){
			if ($splitelement[1] =~ m/Start/) { # If we have "Start" in the variable...
				$splitin2 = $splitelement[1];   # then grab the element we want...
				@splitstart = split/ /,$splitin2; # and SPLIT AGAIN!
				foreach (@splitstart) {
					$splitstart[4] =~ s/\<\/div\>//; #tidy up with substitution
					$fixedStartDate = "$splitstart[2] $splitstart[3] $splitstart[4]"; #aaand concat our date
					$dm = ParseDate($fixedStartDate); #finally we get to ParseDate
					$fixedPubDate = $time{'Day, d Mon yyyy hh:mm:ss', $dm}; # Change that date from one format to the next
				}
			}
		}
	}
	$item->pubDate($fixedPubDate);
}

 $feed->to_file( "htdocs/sharepoint-newdates.rss" );

That fixes my published date, and then I change the date of upcoming events to something like: Today, Tomorrow, etc with this:

require LWP::UserAgent;
use XML::FeedPP;
use Time::Format;
use Date::Manip;

my $source = 'htdocs/sharepoint-newdates.rss';
my $feed = XML::FeedPP->new( $source );

# Iterates through several arrays to find items matching "Start", strips date and time 
# Sends date and time from sharepoint Start Time through "ParseDate" from Date::Manip
# Feeds resulting fixed date and time into the current items pubDate

foreach $item ( $feed->get_item() ) 
{
    $description = $item->description(); # loads RSS item <description> to make an array next
	@splitdesc = split /\<div\>/, $description; #initial split done on div tag
	foreach (@splitdesc)
	{
		$splitdesc[1] =~ s/\<b\>Meeting Room\:\<\/b\> //; # Remove Unnecessary tags before the room
		$splitdesc[1] =~ s/\<\/div\>//;  # Remove Unnecessary tags after the room
		chomp($splitdesc[1]); # Strips newline
		$splitdesc[2] =~ s/\<b\>Start Time\:\<\/b\> //; # Remove Unnecessary tags before the start
		$splitdesc[2] =~ s/\<\/div\>//;  # Remove Unnecessary tags after the start
		chomp($splitdesc[2]); # Strips newline
		$splitdesc[3] =~ s/\<b\>End Time\:\<\/b\> //; # Remove Unnecessary tags before the end
		$splitdesc[3] =~ s/\<\/div\>//;  # Remove Unnecessary tags after the end
		chomp($splitdesc[3]); # Strips newline
		$splitdesc[5] =~ s/\<\/div\>//;  # Remove Unnecessary tags after any additional details
		chomp($splitdesc[5]); # Strips newline

		$startdm = ParseDate($splitdesc[2]); #Parse date info for start date
		$enddm = ParseDate($splitdesc[3]); #Parse date info for end date
		$startday = $time{'Month dth', $startdm}; # Change that date from one format to the next
		$starttime = $time{'H:mm AM', $startdm}; # Change that date from one format to the next
		$endtime = $time{'H:mm AM', $enddm}; # Change that date from one format to the next
		$tomorrowdate = DateCalc("today","+ 1day",\$err);
		$tomorrowdm = ParseDate($tomorrowdate); #Parse date info for start date
		$tomorrowtime = $time{'Month dth', $tomorrowdm}; # Sets tomorrow time to date in same format as $startday for comparison
				

		
		$item->set( "bookings:endtime" => $endtime );
		$item->set( "bookings:startday" => $startday );
		$item->set( "bookings:starttime" => $starttime );
		$item->set( "bookings:room" => $splitdesc[1] );
		
		$todaytime = $time{'Month dth', time}; # Sets todaytime to current date in same format as $starday for comparison
		if ($startday =~ $todaytime)
		{
			$todaytime = "Today";
			$item->set( "bookings:startday" => $todaytime );
		}
		

		if ($startday =~ $tomorrowtime)
		{
			$tomorrowtime = "Tomorrow";
			$item->set( "bookings:startday" => $tomorrowtime );
		}
		
		$item->description($splitdesc[5]);

	}
}

$feed->xmlns( "xmlns:bookings" => "http://intranet/roombookings/" );
$feed->to_file( "htdocs/sharepoint-newfields.rss" );

I appreciate the reply, but I don’t know with cURL and Perl scripts are. I’m not really a system administrator, I know only the most basic functions of Xibo.

hmm the above code probably works, but I don’t think it’s necessary.

let me explain with example:

Example feed Xibo Blog
So if you enter Date from substitutions it will display:

Which isn’t bad, but good news is you can format is as you see fit

You mentioned, that you’d like something like this July 6, 2016 9:30 AM so let’s try to do that shall we

We will use this to help us PHP: date - Manual
Which means we need this format F j, Y h:i A (you can use g instead of h if you don’t want it to display leading zeros) and we need to put it in well…Date Format in ticker advanced settings like this:

hope that helps.

Thanks for this reply…this is very easy to follow. Appreciate it.
My problem is that our we’re still using Xibo 1.6.4. which does not provide this ‘edit ticker’ functionality as described in your post. Our IT guy has been reluctant to update to the newer version of Xibo. I’ll see if I can talk him into it.

Ah I see, yes you’re most likely right that there is no option like that in 1.6 series (I don’t remember to be honest).

It would be best to update to 1.7.9, it shouldn’t really cause issues and upgrade itself is quite easy, it’s a matter of minutes not hours.

You can find upgrading steps here - http://xibo.org.uk/manual/en/release_notes_1.7.9.html