How to output the seconds in datetime-local input?










0















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


























    0















    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
























      0












      0








      0


      1






      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 '18 at 15:13









      GoendgGoendg

      505




      505






















          3 Answers
          3






          active

          oldest

          votes


















          1














          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

          </div>








          share|improve this answer























          • :) actualy the problem was the angular varsion. I had an old one. thx

            – Goendg
            Nov 13 '18 at 15:51


















          0














          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 '18 at 15:46


















          0














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



           <span>end_date </span>


          It will display the date with time:min:second



          If you just want the time use



          <span> date:'HH:mm:ss'</span>





          share|improve this answer























          • That's not the issue! My problem is the datepicker from HTML

            – Goendg
            Nov 13 '18 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?

            – nircraft
            Nov 13 '18 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 '18 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',
          autoActivateHeartbeat: false,
          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









          1














          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

          </div>








          share|improve this answer























          • :) actualy the problem was the angular varsion. I had an old one. thx

            – Goendg
            Nov 13 '18 at 15:51















          1














          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

          </div>








          share|improve this answer























          • :) actualy the problem was the angular varsion. I had an old one. thx

            – Goendg
            Nov 13 '18 at 15:51













          1












          1








          1







          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

          </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

          </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

          </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

          </div>






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 13 '18 at 15:36









          Aleksey SoloveyAleksey Solovey

          3,5403726




          3,5403726












          • :) actualy the problem was the angular varsion. I had an old one. thx

            – Goendg
            Nov 13 '18 at 15:51

















          • :) actualy the problem was the angular varsion. I had an old one. thx

            – Goendg
            Nov 13 '18 at 15:51
















          :) actualy the problem was the angular varsion. I had an old one. thx

          – Goendg
          Nov 13 '18 at 15:51





          :) actualy the problem was the angular varsion. I had an old one. thx

          – Goendg
          Nov 13 '18 at 15:51













          0














          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 '18 at 15:46















          0














          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 '18 at 15:46













          0












          0








          0







          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 '18 at 15:31









          BartoszTermenaBartoszTermena

          7381211




          7381211












          • Yes, i can. but i would like to solve this one!

            – Goendg
            Nov 13 '18 at 15:46

















          • Yes, i can. but i would like to solve this one!

            – Goendg
            Nov 13 '18 at 15:46
















          Yes, i can. but i would like to solve this one!

          – Goendg
          Nov 13 '18 at 15:46





          Yes, i can. but i would like to solve this one!

          – Goendg
          Nov 13 '18 at 15:46











          0














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



           <span>end_date </span>


          It will display the date with time:min:second



          If you just want the time use



          <span> date:'HH:mm:ss'</span>





          share|improve this answer























          • That's not the issue! My problem is the datepicker from HTML

            – Goendg
            Nov 13 '18 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?

            – nircraft
            Nov 13 '18 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 '18 at 11:00
















          0














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



           <span>end_date </span>


          It will display the date with time:min:second



          If you just want the time use



          <span> date:'HH:mm:ss'</span>





          share|improve this answer























          • That's not the issue! My problem is the datepicker from HTML

            – Goendg
            Nov 13 '18 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?

            – nircraft
            Nov 13 '18 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 '18 at 11:00














          0












          0








          0







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



           <span>end_date </span>


          It will display the date with time:min:second



          If you just want the time use



          <span> date:'HH:mm:ss'</span>





          share|improve this answer













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



           <span>end_date </span>


          It will display the date with time:min:second



          If you just want the time use



          <span> date:'HH:mm:ss'</span>






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 13 '18 at 15:35









          nircraftnircraft

          1,341319




          1,341319












          • That's not the issue! My problem is the datepicker from HTML

            – Goendg
            Nov 13 '18 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?

            – nircraft
            Nov 13 '18 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 '18 at 11:00


















          • That's not the issue! My problem is the datepicker from HTML

            – Goendg
            Nov 13 '18 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?

            – nircraft
            Nov 13 '18 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 '18 at 11:00

















          That's not the issue! My problem is the datepicker from HTML

          – Goendg
          Nov 13 '18 at 15:47





          That's not the issue! My problem is the datepicker from HTML

          – Goendg
          Nov 13 '18 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?

          – nircraft
          Nov 13 '18 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?

          – nircraft
          Nov 13 '18 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 '18 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 '18 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.




          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







          這個網誌中的熱門文章

          How to read a connectionString WITH PROVIDER in .NET Core?

          In R, how to develop a multiplot heatmap.2 figure showing key labels successfully

          Museum of Modern and Contemporary Art of Trento and Rovereto