                     shiftdetaildb.month = JudgeYearAndMonth().startcoursmonth
                     date++
                     
-                    if(date > 30){
+                    if(date > monthrange.length){
                         date = 1
                         flag = 1
                     }

                
                DBmethod().AddandUpdate(newshiftdetaildb, update: true)
            }else{
                shiftdb.id = DBmethod().DBRecordCount(ShiftDetailDB)/30     //新規の場合はレコードの数を割ったidを使う
                shiftdb.shiftimportname = importname
                shiftdb.shiftimportpath = importpath
                shiftdb.salaly = 0

                    newshiftdetaildb.month = JudgeYearAndMonth().startcoursmonth
                    date++
                    
                    if(date > monthrange.length){
                        date = 1
                        flag = 1
                    }
