誰も私はこれらが正しく計算されていない理由を教えてもらえますか?私は時間を1秒追加しようとしていると、フォーマットを適用すると60ミリ秒を追加するようだ? 19::Groovy:日付が正しく計算されていませんか? TimeCategoryを使用して
import java.text.*
import java.util.*
import groovy.time.TimeCategory
def xmlSlurper = new groovy.util.XmlSlurper()
// Get the previous total for number of journals
def journalCountProp = testRunner.testCase.getTestStepByName("Properties")
def journalCountTotal = journalCountProp.getPropertyValue("journalCount")
log.info " 1. Previous JournalCount from last run: "+journalCountTotal
def lastDateProp = testRunner.testCase.getTestStepByName("Properties")
def lastDateHolder = lastDateProp.getPropertyValue("journalQueryDate")
log.info " 2. Previous lastDate from last run: "+lastDateHolder
// Get the response for a given timeline
def response = xmlSlurper.parseText(context.expand('${GET Journal using JournalDate#Response}'));
def currentJournalCount = response.Journals.Journal.size()
log.info " 3. Number of Journals in this Run: "+currentJournalCount
//Getting the date from the last Journal (including an offset as the array count starts at 0)
def lastDate = response.Journals.Journal[currentJournalCount-1].CreatedDateUTC
log.info " 4. CreatedDate from last journal in this response: "+lastDate
//log.info response.Journals.Journal[currentJournalCount-1].CreatedDateUTC
def newdate = Date.parse("yyyy-MM-dd'T'HH:mm:ss.mmm",lastDate.toString())
log.info "dateBeforeChange: "+newdate.format("yyyy-MM-dd'T'HH:mm:ss.mmm")
use(TimeCategory){
newdate = newdate+1.seconds
}
log.info "date After Change: "+newdate.format("yyyy-MM-dd'T'hh:mm:ss.mmm")
log.info " 5. "+newdate.format("yyyy-MM-dd'T'HH:ss:mmm")
OUTPUT:このレスポンスの最後のジャーナルから
CreatedDateに:2007-03-29T23 52.073
dateBeforeChange:2007-03-30T00:13:52.013
日付変更後:2007 -03-30T12:13:53.013
私はそれを理解できませんか?
乾杯、 - hh
は "午前/午後で時間(1-12)" を意味し、一方、リチャード・
質問が破棄されました。 "ありがとう"。 – robbbert
ねえロバート?上記のあなたのコメントを「取得」しているかどうかわかりませんか?私はあなたの緑のダニを与えることを見落としているかもしれません。今すぐ修正されました。 –