看板 Soft_Job 關於我們 聯絡資訊
※ 引述《ppking (老宅男)》之銘言: : 標題: [請益] 請教高手要加3個月的程式寫法 : 時間: Mon Apr 1 15:31:47 2013 : : 如有一個起的變數是2013/04/01 : 則迄的值就為2013/07/01 : 但如遇到2013/03/31 : 則迄的值就要為2013/06/30 : 目前遇到困擾是31日及2月底日期的判斷 : 造成程式寫法要寫很多if寫法 : 不知各位高手有沒有比較簡單的寫法 就可寫出 : 謝謝 : : → ppking:Informix,有mdy(),day(),month(),year()相關日期函數可用 04/01 16:29 : 推 luciferii:想問一下,Informix的ADD_MONTHS不能用嗎? 04/02 02:19 : → ppking:老闆是要以月為基礎,而2/28加3個月就為5/28,因傳統製造業的 04/02 08:41 : → ppking:老闆都很單純,加3個月就是月份加3,月份內天數變化如28,29, 04/02 08:43 : → ppking:30,31,他認為電腦就會排除不正確的日期 04/02 08:45 : → ppking:樓上l大,沒用過Informix的ADD_MONTHS函數,如何使用? 04/02 08:47 : → ppking:樓上lovdkkkk大,的確是如起3/31,則迄就要為6/30 04/02 08:49 沒用過的語言 google到的不知道是不是你要的 http://tinyurl.com/bllgrov ADD_MONTHS Function If the day and month time units in the first argument specify the last day of the month, or if the resulting month has fewer days than the day in the first argument, then the returned value is the last day of the resulting month. Otherwise, the returned value has the same day of the month as the first argument. -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 114.36.48.107
ppking:我會試著用看看,謝謝你 04/02 18:02