How to output the seconds in datetime-local input?











up vote
0
down vote

favorite












i have in Html :



<input type="datetime-local" step=1 ng-model="end_date" required />


and in code (angularJs)



$scope.end_date = new Date('2018-11-10 10:11:15');


and the output, no matter what i do, is '2018-11-10 10:11:00'.
I really need the seconds.
What can i do?



Thx.










share|improve this question


























    up vote
    0
    down vote

    favorite












    i have in Html :



    <input type="datetime-local" step=1 ng-model="end_date" required />


    and in code (angularJs)



    $scope.end_date = new Date('2018-11-10 10:11:15');


    and the output, no matter what i do, is '2018-11-10 10:11:00'.
    I really need the seconds.
    What can i do?



    Thx.










    share|improve this question
























      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      i have in Html :



      <input type="datetime-local" step=1 ng-model="end_date" required />


      and in code (angularJs)



      $scope.end_date = new Date('2018-11-10 10:11:15');


      and the output, no matter what i do, is '2018-11-10 10:11:00'.
      I really need the seconds.
      What can i do?



      Thx.










      share|improve this question













      i have in Html :



      <input type="datetime-local" step=1 ng-model="end_date" required />


      and in code (angularJs)



      $scope.end_date = new Date('2018-11-10 10:11:15');


      and the output, no matter what i do, is '2018-11-10 10:11:00'.
      I really need the seconds.
      What can i do?



      Thx.







      html angularjs datetime






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 13 at 15:13









      Goendg

      505




      505
























          3 Answers
          3






          active

          oldest

          votes

















          up vote
          1
          down vote



          accepted










          For the output, just display it differently with a filter. Such filter already is in AngularJS, it's called date.

          Simply select the format that you need (in your case the seconds would be just 's'). Here is a demo:






          var app = angular.module('myApp', );
          app.controller('myCtrl', function($scope) {
          $scope.end_date = new Date('2018-11-10 10:11:15');
          });

          <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>

          <div ng-app="myApp" ng-controller="myCtrl">

          <input type="datetime-local" step=1 ng-model="end_date" required />
          <hr>
          {{end_date | date:"s"}}

          </div>








          share|improve this answer





















          • :) actualy the problem was the angular varsion. I had an old one. thx
            – Goendg
            Nov 13 at 15:51


















          up vote
          0
          down vote













          You can use very handy directive : https://github.com/eight04/angular-datetime
          and then :



          <input datetime="HH:mm:ss"  step=1 ng-model="myDate" required />


          plunker: http://plnkr.co/edit/iOs0mO4ZuTfmm00HGThp?p=preview






          share|improve this answer





















          • Yes, i can. but i would like to solve this one!
            – Goendg
            Nov 13 at 15:46


















          up vote
          0
          down vote













          you should be able to make use of Date filter in angularJs.



           <span>{{end_date | date:'MM/dd/yyyy HH:mm:ss'}}</span>


          It will display the date with time:min:second



          If you just want the time use



          <span>{{end_date | date:'HH:mm:ss'}}</span>





          share|improve this answer





















          • That's not the issue! My problem is the datepicker from HTML
            – Goendg
            Nov 13 at 15:47










          • yeah, so try applying the same filter to the value obtained from datePicker, You should be able to get the seconds. unless i am missing something here?
            – nkuma_12
            Nov 13 at 16:39










          • as i said @Aleksey Solovey answer, it was my bad, i've used an old version of angular, wich, probalbly, didn't have spport for seconds. THX anyway
            – Goendg
            Nov 14 at 11:00













          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53284042%2fhow-to-output-the-seconds-in-datetime-local-input%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          3 Answers
          3






          active

          oldest

          votes








          3 Answers
          3






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          1
          down vote



          accepted










          For the output, just display it differently with a filter. Such filter already is in AngularJS, it's called date.

          Simply select the format that you need (in your case the seconds would be just 's'). Here is a demo:






          var app = angular.module('myApp', );
          app.controller('myCtrl', function($scope) {
          $scope.end_date = new Date('2018-11-10 10:11:15');
          });

          <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>

          <div ng-app="myApp" ng-controller="myCtrl">

          <input type="datetime-local" step=1 ng-model="end_date" required />
          <hr>
          {{end_date | date:"s"}}

          </div>








          share|improve this answer





















          • :) actualy the problem was the angular varsion. I had an old one. thx
            – Goendg
            Nov 13 at 15:51















          up vote
          1
          down vote



          accepted










          For the output, just display it differently with a filter. Such filter already is in AngularJS, it's called date.

          Simply select the format that you need (in your case the seconds would be just 's'). Here is a demo:






          var app = angular.module('myApp', );
          app.controller('myCtrl', function($scope) {
          $scope.end_date = new Date('2018-11-10 10:11:15');
          });

          <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>

          <div ng-app="myApp" ng-controller="myCtrl">

          <input type="datetime-local" step=1 ng-model="end_date" required />
          <hr>
          {{end_date | date:"s"}}

          </div>








          share|improve this answer





















          • :) actualy the problem was the angular varsion. I had an old one. thx
            – Goendg
            Nov 13 at 15:51













          up vote
          1
          down vote



          accepted







          up vote
          1
          down vote



          accepted






          For the output, just display it differently with a filter. Such filter already is in AngularJS, it's called date.

          Simply select the format that you need (in your case the seconds would be just 's'). Here is a demo:






          var app = angular.module('myApp', );
          app.controller('myCtrl', function($scope) {
          $scope.end_date = new Date('2018-11-10 10:11:15');
          });

          <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>

          <div ng-app="myApp" ng-controller="myCtrl">

          <input type="datetime-local" step=1 ng-model="end_date" required />
          <hr>
          {{end_date | date:"s"}}

          </div>








          share|improve this answer












          For the output, just display it differently with a filter. Such filter already is in AngularJS, it's called date.

          Simply select the format that you need (in your case the seconds would be just 's'). Here is a demo:






          var app = angular.module('myApp', );
          app.controller('myCtrl', function($scope) {
          $scope.end_date = new Date('2018-11-10 10:11:15');
          });

          <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>

          <div ng-app="myApp" ng-controller="myCtrl">

          <input type="datetime-local" step=1 ng-model="end_date" required />
          <hr>
          {{end_date | date:"s"}}

          </div>








          var app = angular.module('myApp', );
          app.controller('myCtrl', function($scope) {
          $scope.end_date = new Date('2018-11-10 10:11:15');
          });

          <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>

          <div ng-app="myApp" ng-controller="myCtrl">

          <input type="datetime-local" step=1 ng-model="end_date" required />
          <hr>
          {{end_date | date:"s"}}

          </div>





          var app = angular.module('myApp', );
          app.controller('myCtrl', function($scope) {
          $scope.end_date = new Date('2018-11-10 10:11:15');
          });

          <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.9/angular.min.js"></script>

          <div ng-app="myApp" ng-controller="myCtrl">

          <input type="datetime-local" step=1 ng-model="end_date" required />
          <hr>
          {{end_date | date:"s"}}

          </div>






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 13 at 15:36









          Aleksey Solovey

          3,5203726




          3,5203726












          • :) actualy the problem was the angular varsion. I had an old one. thx
            – Goendg
            Nov 13 at 15:51


















          • :) actualy the problem was the angular varsion. I had an old one. thx
            – Goendg
            Nov 13 at 15:51
















          :) actualy the problem was the angular varsion. I had an old one. thx
          – Goendg
          Nov 13 at 15:51




          :) actualy the problem was the angular varsion. I had an old one. thx
          – Goendg
          Nov 13 at 15:51












          up vote
          0
          down vote













          You can use very handy directive : https://github.com/eight04/angular-datetime
          and then :



          <input datetime="HH:mm:ss"  step=1 ng-model="myDate" required />


          plunker: http://plnkr.co/edit/iOs0mO4ZuTfmm00HGThp?p=preview






          share|improve this answer





















          • Yes, i can. but i would like to solve this one!
            – Goendg
            Nov 13 at 15:46















          up vote
          0
          down vote













          You can use very handy directive : https://github.com/eight04/angular-datetime
          and then :



          <input datetime="HH:mm:ss"  step=1 ng-model="myDate" required />


          plunker: http://plnkr.co/edit/iOs0mO4ZuTfmm00HGThp?p=preview






          share|improve this answer





















          • Yes, i can. but i would like to solve this one!
            – Goendg
            Nov 13 at 15:46













          up vote
          0
          down vote










          up vote
          0
          down vote









          You can use very handy directive : https://github.com/eight04/angular-datetime
          and then :



          <input datetime="HH:mm:ss"  step=1 ng-model="myDate" required />


          plunker: http://plnkr.co/edit/iOs0mO4ZuTfmm00HGThp?p=preview






          share|improve this answer












          You can use very handy directive : https://github.com/eight04/angular-datetime
          and then :



          <input datetime="HH:mm:ss"  step=1 ng-model="myDate" required />


          plunker: http://plnkr.co/edit/iOs0mO4ZuTfmm00HGThp?p=preview







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 13 at 15:31









          BartoszTermena

          36316




          36316












          • Yes, i can. but i would like to solve this one!
            – Goendg
            Nov 13 at 15:46


















          • Yes, i can. but i would like to solve this one!
            – Goendg
            Nov 13 at 15:46
















          Yes, i can. but i would like to solve this one!
          – Goendg
          Nov 13 at 15:46




          Yes, i can. but i would like to solve this one!
          – Goendg
          Nov 13 at 15:46










          up vote
          0
          down vote













          you should be able to make use of Date filter in angularJs.



           <span>{{end_date | date:'MM/dd/yyyy HH:mm:ss'}}</span>


          It will display the date with time:min:second



          If you just want the time use



          <span>{{end_date | date:'HH:mm:ss'}}</span>





          share|improve this answer





















          • That's not the issue! My problem is the datepicker from HTML
            – Goendg
            Nov 13 at 15:47










          • yeah, so try applying the same filter to the value obtained from datePicker, You should be able to get the seconds. unless i am missing something here?
            – nkuma_12
            Nov 13 at 16:39










          • as i said @Aleksey Solovey answer, it was my bad, i've used an old version of angular, wich, probalbly, didn't have spport for seconds. THX anyway
            – Goendg
            Nov 14 at 11:00

















          up vote
          0
          down vote













          you should be able to make use of Date filter in angularJs.



           <span>{{end_date | date:'MM/dd/yyyy HH:mm:ss'}}</span>


          It will display the date with time:min:second



          If you just want the time use



          <span>{{end_date | date:'HH:mm:ss'}}</span>





          share|improve this answer





















          • That's not the issue! My problem is the datepicker from HTML
            – Goendg
            Nov 13 at 15:47










          • yeah, so try applying the same filter to the value obtained from datePicker, You should be able to get the seconds. unless i am missing something here?
            – nkuma_12
            Nov 13 at 16:39










          • as i said @Aleksey Solovey answer, it was my bad, i've used an old version of angular, wich, probalbly, didn't have spport for seconds. THX anyway
            – Goendg
            Nov 14 at 11:00















          up vote
          0
          down vote










          up vote
          0
          down vote









          you should be able to make use of Date filter in angularJs.



           <span>{{end_date | date:'MM/dd/yyyy HH:mm:ss'}}</span>


          It will display the date with time:min:second



          If you just want the time use



          <span>{{end_date | date:'HH:mm:ss'}}</span>





          share|improve this answer












          you should be able to make use of Date filter in angularJs.



           <span>{{end_date | date:'MM/dd/yyyy HH:mm:ss'}}</span>


          It will display the date with time:min:second



          If you just want the time use



          <span>{{end_date | date:'HH:mm:ss'}}</span>






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 13 at 15:35









          nkuma_12

          39311




          39311












          • That's not the issue! My problem is the datepicker from HTML
            – Goendg
            Nov 13 at 15:47










          • yeah, so try applying the same filter to the value obtained from datePicker, You should be able to get the seconds. unless i am missing something here?
            – nkuma_12
            Nov 13 at 16:39










          • as i said @Aleksey Solovey answer, it was my bad, i've used an old version of angular, wich, probalbly, didn't have spport for seconds. THX anyway
            – Goendg
            Nov 14 at 11:00




















          • That's not the issue! My problem is the datepicker from HTML
            – Goendg
            Nov 13 at 15:47










          • yeah, so try applying the same filter to the value obtained from datePicker, You should be able to get the seconds. unless i am missing something here?
            – nkuma_12
            Nov 13 at 16:39










          • as i said @Aleksey Solovey answer, it was my bad, i've used an old version of angular, wich, probalbly, didn't have spport for seconds. THX anyway
            – Goendg
            Nov 14 at 11:00


















          That's not the issue! My problem is the datepicker from HTML
          – Goendg
          Nov 13 at 15:47




          That's not the issue! My problem is the datepicker from HTML
          – Goendg
          Nov 13 at 15:47












          yeah, so try applying the same filter to the value obtained from datePicker, You should be able to get the seconds. unless i am missing something here?
          – nkuma_12
          Nov 13 at 16:39




          yeah, so try applying the same filter to the value obtained from datePicker, You should be able to get the seconds. unless i am missing something here?
          – nkuma_12
          Nov 13 at 16:39












          as i said @Aleksey Solovey answer, it was my bad, i've used an old version of angular, wich, probalbly, didn't have spport for seconds. THX anyway
          – Goendg
          Nov 14 at 11:00






          as i said @Aleksey Solovey answer, it was my bad, i've used an old version of angular, wich, probalbly, didn't have spport for seconds. THX anyway
          – Goendg
          Nov 14 at 11:00




















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53284042%2fhow-to-output-the-seconds-in-datetime-local-input%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to send String Array data to Server using php in android

          Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

          Is anime1.com a legal site for watching anime?