Convert date to week - CFBuilder2018
My application is storing orderdata, including ‘DateOfDelivery’ - DoD, in a database (local). I wish to use DoD to calculate the corresponding weeknumber and found a method (se printout). When the function is called from onClick getElementById id=”week” is updated with correct weeknumber - but the result is only displayed. I want to capture the value and save it in the database. Is it possible in CF? Ariel_1234
______________ <!DOCTYPE html> <html> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initital-scale=1.0"> <title>weekNbr</title> <link href="home.css" rel="stylesheet" type="text/css"> <link href="createNewOrder.css" rel="stylesheet" type="text/css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.18.1/moment.min.js"></script> <head> </head> <script> function checkWeek() { var s = document.getElementById('test').value; var m = moment(s, 'YYYY-MM-DD'); document.getElementById('Week').value = m.format('W'); </script>
<cfquery datasource="ajour" name="getOrderInfo"> SELECT * FROM APP.TBL_ORDER WHERE ORDERID = 39 </cfquery> <div class="display" > <TABLE id="displayOrderLine" CELLPADDING="3" CELLSPACING="0"> <tr> <th>Order ID</th> <th>Supplier</th> <th>Season </th> <th>Date of delivery</th> <th>WeekNbr</th> <th>Total</th> <th>Status</th> </tr> <CFOUTPUT QUERY="getOrderInfo"> <TR BGCOLOR="##C0C0C0"> <TD>#ORDERID#</TD> <TD>#SPLRNAME#</TD> <TD>#SEASON#</TD> <TD>#DATEOFDELIVERY#</TD> <TD>#WEEKNBR#</TD> <TD>#GRANDTOTAL#</TD> <TD>#STATUS#</TD> </TR> </CFOUTPUT> </TABLE> </div> <cfset deliveryDate = #getOrderInfo.DATEOFDELIVERY#/> <cfform id="testing"> <cfinput name="dString" id="test" value="#deliveryDate#"> <button onclick="checkWeek(this)">Check week number</button><br> </cfform> <input id="Week"><br> </html> |
|
|
