javascriptを使用して翌日に見つけようとしましたが、それは静的な日付では完璧でしたが、動的な日付では機能しませんでした。javascriptを使用して翌日を見つける方法
また1間12日のために働く、私にそれのための完全な出力が得られ、高い日には使用できませその後、12
この問題を解決するために私を助けてください!日付に日数を追加する
<script type="text/javascript">
function next_day() { \t
\t // var date = document.getElementById('date').value;
\t var textbox_Value = document.getElementById('date').value;
\t console.log("input date : " + textbox_Value);
\t var fDate = new Date(textbox_Value.replace(/(\d{2})-(\d{2})-(\d{4})/, "$2/$1/$3")); //change date formate mm/dd/yyyy to dd/mm/yyyy
\t var dayWithSlashes = (fDate.getDate()) + '/' + (fDate.getMonth()+1) + '/' + fDate.getFullYear();
\t console.log("Foramat changed date : " + dayWithSlashes);
\t var day_in_js_format = new Date(dayWithSlashes);
\t console.log("convert in date format : " + day_in_js_format);
\t day_in_js_format.setDate(day_in_js_format.getDate() + 1);
\t console.log("day_in_js_format++ : " + day_in_js_format);
\t var final_Result = (day_in_js_format.getDate()) + '/' + (day_in_js_format.getMonth()+1) + '/' + day_in_js_format.getFullYear();
\t console.log("next day : " + final_Result);
}
</script>
<!DOCTYPE html>
<html>
<head>
\t <title>
\t \t Next day using javascript
\t </title>
\t <!-- Latest compiled and minified CSS & JS -->
\t <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous">
</head>
<body>
\t <div class="container fix-top">
\t \t <form action="" method="POST" role="form">
\t \t \t <legend>Form title</legend>
\t \t
\t \t \t <div class="form-group">
\t \t \t \t <label for="">Next day</label>
\t \t \t \t <input type="text" class="form-control" id="date" name="date" placeholder="Input field">
\t \t \t </div> \t \t \t
\t \t
\t \t \t <button type="button" onclick="next_day();" class="btn btn-primary">Submit</button>
\t \t </form>
\t </div>
\t
\t <script src="//code.jquery.com/jquery.js"></script>
\t <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>
</body>
</html>
日付を作成するときに月と日付を混在させているとのことです。 – Teemu
日付オブジェクトの作成時に非標準のdd/mm/yyyy形式を使用しないでください。代わりにyyyy-mm-ddを使用してください。 – JJJ
私は月と日付を混在させませんでした。理解を深めるためにログを確認してください。 – HirenMangukiya