If we assume the values are integers rather than true time - then adapting zbor's suggestion:

=MOD(G6-F6,12)-0.5*(MOD(G6-F6,12)>6)

Per forum rules please retitle your thread though to something more appropriate - eg "calculate shift duration" (this helps others with similar questions)