Kindly refer to the following link(s):
What is the minimum time for Itikaf
Can we leave for work during day while in Itekaf & come back at night to the masjid
What is the minimum time for Itekaf in Ramadan?
Is it permissible to talk to your spouse while in Itekaf?