Date()。getTime()から数値を取得するクリック機能があります。私はこの数字を取って、私の見解でカウントダウンで彼を変換したい。Date()。getTime()からJavascriptでカウントダウンを作成するにはどうすればよいですか?
私はIonicフレームワーク1xでjavascriptのみを使用しています。
var currentDate = new Date().getTime();
console.log(currentDate);
var secondDate = new Date(item.date).getTime();
console.log(secondDate);
secondDate = new Date(secondDate).getSeconds();
console.log(secondDate);
$scope.countdown = secondDate;
ありがとうございますczosel!それは完璧に働いています。時間については、カウントダウンを元に戻す簡単な方法がありますか? –
よろしくお願いします!カウントダウンを元に戻すには、現在の日付とカウントダウンしている日付の差を計算し、その値をスコープにバインドします。 –