The army was barely ready when, in February 1794, the war broke out.
- Are the commas around "in February 1794" correct?
- Could I leave them out?
- Or should I rather move "in February 1794" to the end or to the main clause?
In this case you should include the commas. "in February 1794" is an unnecessary phrase, meaning that the sentence has the same meaning if you omit it:
The army was barely ready when the war broke out.
Unnecessary words, phrases, and clauses should be set off by commas. If the date of the war was essential to the meaning to the sentence, you would not include commas:
The army was barely ready when the war in February 1794 broke out.
When used in this way, the phrase about the date changes the subject; there may have been multiple wars, and the one in 1794 was the one the army was not prepared for. Without the phrase the sentence could refer to any of the wars, with it only one. Note that in the first example, even without the date phrase the sentence only referred to one war ("the war," presumably established by context.)
The army was barely ready when the war, in February 1794, broke out.
One can set off a date like that when there is ambiguity.
However, in this case, one can move it like so:
The army was barely ready when the war broke out in February 1794.