Jump to content

Erwinator

New Members
  • Posts

    1
  • Joined

  • Last visited

Erwinator's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi everyone, new here, I need to convert this text to 24 HR format, keeping the format like this "Monday 9:00,12:00,13:00,17:30|Tuesday, 9:00,12:00,13:00,17:30| Wednesday, 9:00,12:00,13:00,17:30|... Closed days remain the same This is the information I scraped already: Saturday, Closed; Sunday, Closed; Monday, 9AM to 12PM, 1 to 5:30PM; Tuesday, 9AM to 12PM, 1 to 5:30PM; Wednesday, 9AM to 12PM, 1 to 5:30PM; Thursday, 9AM to 12PM, 1 to 5:30PM; Friday, 9AM to 12PM, 1 to 5:30PM I have been trying with multiple replaces and date functions but got nowhere since I am a newbie on PHP This is what I am working with so far function weekday( $weekdays) { $weekdays = "Saturday, Closed; Sunday, Closed; Monday, 9AM to 12PM, 1 to 5:30PM; Tuesday, 9AM to 12PM, 1 to 5:30PM; Wednesday, 9AM to 12PM, 1 to 5:30PM; Thursday, 9AM to 12PM, 1 to 5:30PM; Friday, 9AM to 12PM, 1 to 5:30PM"; if (empty( $atts['name'] )) $sunday = explode(';', $weekdays)[0]; $monday = explode(';', $weekdays)[1]; $tuesday = explode(';', trim(explode(';', $weekdays)[2]))[0]; $wednesday = explode(';', trim(explode(';', $weekdays)[3]))[0]; $thursday = explode(';', trim(explode(';', $weekdays)[4]))[0]; $friday = explode(';', trim(explode(';', $weekdays)[5]))[0]; $saturday = explode(';', trim(explode(';', $weekdays)[6]))[0]; echo date('l, G:i", $sunday.)'<br>'; echo date('l, G:i", $monday).'<br>'; echo date('l, G:i", $tuesday.)'<br>'; echo date('l, G:i", $wednesday.)'<br>'; echo date('l, G:i", $thursday.)'<br>'; echo date('l, G:i", $friday.)'<br>'; echo date('l, G:i", $saturday.)'<br>'; } Thank you for the help
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.