The novel is set in Paris in the upper-middle class environment of the leading journalists of the newspaper La Vie Française and their friends. It tells the story of Georges Duroy, who has spent three years in military service in Algeria. After working for six months as a clerk in Paris, an encounter with his former comrade, Forestier, enables him to start a career as a journalist. From a reporter of minor events and soft news, he gradually climbs his way up to chief editor. Duroy initially owes his success to Forestier’s wife, Madeleine, who helps him write his first articles and, when he later starts writing lead articles, she adds an edge and poignancy to them. At the same time, she uses her connections among leading politicians to provide him with behind the scenes information which allows him to become actively involved in politics. Duroy is also introduced to many politicians in Madame Forestier’s drawing-room. Duroy becomes the lover of Forestiers' friend Mme de Marelle, another influential woman. Duroy later tries to seduce Madeleine Forestier to get even with her husband, but she repulses Duroy’s sexual advances and offers that they become true friends without ulterior motives.
In a few months, Charles Forestier’s health deteriorates and he travels to the south of France to regain it. Soon afterwards, Duroy receives a letter from Madeleine imploring him to join her and help her bear the last moments of her husband’s life. When Forestier dies, Duroy asks Madeleine to marry him. After a few weeks to consider, she agrees. Georges now signs his articles Du Roy (an aristocratic style of French name) in order to add prestige to his name. The married couple travels to Normandy, the region of Georges’s childhood, and meets his peasant parents. Finding the reality different from her romantic expectations, Madeleine feels very uncomfortable with his parents and so their stay with them is short. In the newspaper office, Duroy is ridiculed for having his articles written by his wife, just as the late Forestier had his articles written by her. His newspaper colleagues call him ‘Forestier’, which drives Georges mad and he becomes heavily jealous of Madeleine, insisting that she admit having been unfaithful to Forestier, but she never does.
In order to suppress the stings of jealousy, Duroy starts an affair with Mme Walter, the wife of the owner of the newspaper. He especially enjoys the conquest as he is her first extramarital lover. Later on, however, he regrets the decision, for he cannot get rid of her when he does not want her. Duroy’s relations with his wife become estranged; at one point, he takes a police superintendent and three other police officers to a flat in which his wife is meeting Monsieur Laroche-Mathieu, her lover. They catch the two in the act of adultery, which was then a crime punishable under the law. Duroy used the police as witnesses of his wife's adultery to facilitate their divorce. He did not have her or her lover arrested although the police gave him the option to do so.
In the last two chapters, Duroy's ascent to power continues. Duroy, now a single man, makes use of his chief’s daughter's infatuation with him, and arranges an elopement with her. The parents then have no other choice but to grant their assent to the marriage. The last chapter shows Duroy savouring his success at the wedding ceremony at which 'all those who figured prominently in society' are present. His thoughts, however, chiefly belong to Mme de Marelle who, when wishing him all the best, indicates that she has forgiven him for his new marriage and that their intimate meetings can be taken up again.

Question: How many years was Duroy in the Algerian military?
Answer: Three years.