私はJaggeryjsで以下のコードを使用しています。私はまだテストしていませんが、期待される結果を得ています。
var currentDate = new Date();
var requiredDate;
log.info(currentDate)
var set=currentDate.setHours(0)
if(currentDate.getDay() == 1)
{
requiredDate=new Date(currentDate.getFullYear(),currentDate.getMonth(),currentDate.getDate()-7)
}
else if(currentDate.getDay() == 2)
{
requiredDate=new Date(currentDate.getFullYear(),currentDate.getMonth(),currentDate.getDate()-8)
}
else if(currentDate.getDay() == 3)
{
requiredDate=new Date(currentDate.getFullYear(),currentDate.getMonth(),currentDate.getDate()-9)
}
else if(currentDate.getDay() == 4)
{
requiredDate=new Date(currentDate.getFullYear(),currentDate.getMonth(),currentDate.getDate()-10)
}
else if(currentDate.getDay() == 5)
{
requiredDate=new Date(currentDate.getFullYear(),currentDate.getMonth(),currentDate.getDate()-4)
}
else if(currentDate.getDay() == 6)
{
requiredDate=new Date(currentDate.getFullYear(),currentDate.getMonth(),currentDate.getDate()-5)
}
else if(currentDate.getDay() == 7)
{
requiredDate=new Date(currentDate.getFullYear(),currentDate.getMonth(),currentDate.getDate()-6)
}
var start=Date.parse(requiredDate)
log.info("Start-Date["+start+"]")
log.info("End----------------------------------------------")
var currentDate = new Date();
log.info(currentDate)
var end;
if(currentDate.getDay() == 7)
{
end=new Date(currentDate.getFullYear(),currentDate.getMonth(),currentDate.getDate()-2)
}
else if(currentDate.getDay() == 6)
{
end=new Date(currentDate.getFullYear(),currentDate.getMonth(),currentDate.getDate()-1)
}
else if(currentDate.getDay() == 5)
{
end=Date.parse(currentDate)
log.info("End Date ["+end+"]")
}
else if(currentDate.getDay() == 4)
{
end=new Date(currentDate.getFullYear(),currentDate.getMonth(),currentDate.getDate()-6)
}
else if(currentDate.getDay() == 3)
{
end=new Date(currentDate.getFullYear(),currentDate.getMonth(),currentDate.getDate()-5)
}
else if(currentDate.getDay() == 2)
{
end=new Date(currentDate.getFullYear(),currentDate.getMonth(),currentDate.getDate()-4)
}
else if(currentDate.getDay() == 1)
{
end=new Date(currentDate.getFullYear(),currentDate.getMonth(),currentDate.getDate()-3)
}
end=Date.parse(currentDate);
log.info("End-Date["+end+"]")
query="taskCreateTimestamp:["+start+" TO "+end+"]";
あなたの質問は「タイムスタンプの有効性を確認する方法は、月曜日、火曜日の水曜日か他の日か?コードでは先週の給料を計算するよう求めています。あなたが結果で欲しいと思っている帽子 – mean
あいまいさのために申し訳ありません。私は先週の給料のみを計算する必要があります。 @mean –
最後に、あなたは現在の日付を望んでいて、前の日から7日目は今からですよね? – mean