Automatically add class to link based on link text

If I understand it correctly you want a visual indicator for departures relevant on the current time.

One solution will be using Javascript and provide a way for the element to be identified as passed or active schedule time.

HTML

<div id="myElement">
  <a href="https://myawesomenewsite.com/departuretime/1253">1253</a>
  <a href="https://myawesomenewsite.com/departuretime/1255">1255</a>
  <a href="https://myawesomenewsite.com/departuretime/0955">0955</a>
  <a href="https://myawesomenewsite.com/departuretime/2213">2213</a>
</div>

JAVASCRIPT

// find elements
var rootElements = $("#myElement a");

rootElements.each(function(index, item){

 var url = item.href,
 arr_split = url.split("https://wordpress.stackexchange.com/"),
 arr_index = arr_split.length-1,
 departureTime = arr_split[arr_index],
 date = new Date(),
 myTime = date.getHours()+''+date.getMinutes();

 //add your class like this
 item.classList.add(myTime);

 //but you can also spice it up a bit
if(departureTime>myTime){
     item.classList.add("you_have_time");
}else{
    item.classList.add("you_dont_have_time");
}

});

CSS

.you_have_time{
  color:green;
}

.you_dont_have_time{
  color:red;
}

And ofcourse the jsfiddle