Weird date calculation problem
I am having a problem I do not understand. I am trying to find the sunday before an employee's start date. The following works beautifully for ALL employees except one and I cannot figure out why that one fails. The employee in question has a start date of 2006-03-14 or 3351297600 CL-USER 17 > (setf EmployeeStartDate 3351297600) CL-USER 18 > (decode-universal-time EmployeeStartDate) 0 0 0 14 3 2006 1 T 5 CL-USER 19 > (setf EmployeeStartDay (nth 6 (multiple-value-list (decode- universal-time EmployeeStartDate)))) 1 CL-USER 20 > (if (/= EmployeeStartDay 6) (setf Employeeweekbeginning (- EmployeeStartDate (* (+ 1 EmployeeStartDay) 86400))) (setf Employeeweekbeginning EmployeeStartDate) ) 3351124800 CL-USER 21 > (decode-universal-time Employeeweekbeginning) 0 0 23 11 3 2006 5 NIL 5 As you can see it returns the Saturday before instead of Sunday, it is off by 1 hour. Since 86400 = (* 24 60 60) or 1 day why would I be an hour off? Like I said ALL the other dates work just not this one. Am I missing something? Thanks, William