The Confederacy lasted for about 4 years. It was formed in early 1861, with its government established in February 1861, and it effectively ceased to exist by May 1865 after Confederate forces surrendered. The American Civil War began on April 12, 1861, with the Confederate attack on Fort Sumter, and the war ended when Confederate General Robert E. Lee surrendered on April 9, 1865, with most other Confederate forces surrendering soon after by May 1865.
In days, this duration is roughly from February 1861 to May 1865, which is about 4 years and 3 months, or approximately 1,550 days.