How to output the seconds in datetime-local input?
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
add a comment |
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
add a comment |
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
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
html angularjs datetime
asked Nov 13 '18 at 15:13
GoendgGoendg
505
505
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
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>
:) actualy the problem was the angular varsion. I had an old one. thx
– Goendg
Nov 13 '18 at 15:51
add a comment |
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
Yes, i can. but i would like to solve this one!
– Goendg
Nov 13 '18 at 15:46
add a comment |
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>
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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>
:) actualy the problem was the angular varsion. I had an old one. thx
– Goendg
Nov 13 '18 at 15:51
add a comment |
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>
:) actualy the problem was the angular varsion. I had an old one. thx
– Goendg
Nov 13 '18 at 15:51
add a comment |
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>
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>
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
add a comment |
:) 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
add a comment |
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
Yes, i can. but i would like to solve this one!
– Goendg
Nov 13 '18 at 15:46
add a comment |
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
Yes, i can. but i would like to solve this one!
– Goendg
Nov 13 '18 at 15:46
add a comment |
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
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
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
add a comment |
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
add a comment |
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>
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
add a comment |
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>
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
add a comment |
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>
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>
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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