BOD at 'A' is 0500 LMT, while EOD at 'B' is 1830 LMT.
If 'A' is on 131°E Longitude and 'B' is on 146°E Longitude -
You are on top of the 15 degrees longitude difference = 1 hour time difference so that, being the difficult bit, is a good start.
First, might I suggest that you stay away from canned subtraction solutions ? It works far better if you think it through along the way. Then you are better placed to detect (and correct) any errors you may make.
We notice that the two locations are at different longitudes. This means that we are talking apples and oranges as the two daylight considerations can't readily be compared as they stand. If we try to take differences in these circumstances, we are talking gobbledegook.
So, what to do ? We need to change the numbers so that we are talking apples and apples. This is simple enough as we just need to change the information so that it relates everything to one longitude value and then we can compare numbers. It doesn't matter what longitude you might choose.
(a) you might refer both numbers, say, to GMT (Zulu or UTC - pick whichever you prefer), but that involves more calculations than necessary and every calculation comes with a risk of error so, probably, not the best way to approach the problem. You could, just as easily, have chosen any other longitude value but, why bother ?
(b) you might refer both numbers, say, to A's longitude. That just involves adjusting the data for B
(c) you might refer both numbers, say, to B's longitude. That just involves adjusting the data for A
Pick whichever you wish to run with ... all will end up with the same answer. Why don't we try each in turn to see that this is the case ?
(a) refer both to UTC
BOD A is 0500 - 131/15 = 0500 - 8.7333 hours = 0500 - 8:44 = 2016 the previous day
EOD B is 1830 - 146/15 = 1830 - 9.7333 hours = 1830 - 9:44 = 0846 today
difference is (2400 - 2016) + 0846 = 12:30
(b) refer both to A's longitude
BOD A is 0500
EOD B is 1830 - (146 - 131)/15 = 1830 - 1:00 = 1730 (B is east of A, so the time is ahead of A's)
difference is 1730 - 0500 = 12:30
(c) refer both to B's longitude
BOD A = 0500 + (146 - 131)/15 = 0500 + 1:00 = 0600 (A is west of B, so the time is behind B's)
EOD B is 1830
difference is 1830 - 0600 = 12:30
Which is best ? I suggest either of (b) or (c) as the minimum number of calculations presents the minimum risk of error in the final answer. Having said that, most people, probably, would opt for (a) as that is the usual "canned" solution. As you can see from the three examples, though, it doesn't matter, so long as you avoid errors. (Hopefully, I've managed to make no errors along the way .... )