0

i add data into database like this

or.Date = DateTime.Now;
            or.Inches = item.Inches;
            or.note = not;
            or.paid = pad;
            or.ProductDes = item.ProductDes;
            or.ProductId = item.Id;
            or.ProductName = item.ProductName;
            or.ProductQty = item.ProductQty;
            or.ProductRate = item.ProductRate;
            or.SaleProduct = item.SaleProduct;
db.orders.Add(or);
db.SaveChanges();

date saved into database this form 08/06/2018 11:18:10

now i get all the data but date formate is not in correct formate click here to see Image

this is html code..here try all the angularjs date formate but i get a wrong date formate... my date datatype is datetime in database

<tr st-select-row="row" st-select-mode="multiple" ng-repeat="row in cca">
                                    <td style="color:black">#{{$index + 1}}</td>
                                    <td style="color:black">{{row.Invoice}}</td>
                                    <td style="color:black">{{row.Date | date:'MM/dd/yyyy'}}</td>
                                    <td style="color:black">{{row.TotalItem}}</td>
                                    <td style="color:black">{{row.TotalBill}}</td>
                                    <td style="color:black">{{row.remaining}}</td>
                                    <td>
                                        <div class="btn-group" role="group" aria-label="...">
                                            <button type="button" class="btn btn-default" ng-click="cateedit(row.Id)">
                                                <i class="glyphicon glyphicon-pencil" style="color:black">
                                                </i>
                                            </button>
                                            <button type="button" ng-show="catehide" class="btn btn-danger" ng-click="catedelete(row.Id)">
                                                <i class="glyphicon glyphicon-trash" style="color:white">
                                                </i>
                                            </button>
                                        </div>
                                    </td>
                                </tr>

my angularjs code is

function checking() {
    $http.get("/Login/checking").then(function (response) {
        if (response.data.success) {
            $scope.ordersss = response.data.Content;
            $scope.adminsalehistory = "Your Sale History";
        } else {
            $scope.ordersss = response.data.Content;
            $scope.adminsalehistory = "All Sale History";
        }
    })
}
10
  • You can use DateTime.ParseExact(dateString, format, CultureInfo.InvariantCulture) to convert your date into desire format and pass date in string format from view page. Commented Jun 8, 2018 at 6:53
  • Refer this Q/A Commented Jun 8, 2018 at 6:53
  • can you try out solution Commented Jun 8, 2018 at 6:54
  • @gaurav bhavsar can you write the answer? Commented Jun 8, 2018 at 6:57
  • thanks for your response but i face little bit confusion now i shared a angularjs code how i change a date formate.plz see a code Commented Jun 8, 2018 at 7:03

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.