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.
html angularjs datetime
add a comment |
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.
html angularjs datetime
add a comment |
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.
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 at 15:13
Goendg
505
505
add a comment |
add a comment |
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>
:) actualy the problem was the angular varsion. I had an old one. thx
– Goendg
Nov 13 at 15:51
add a comment |
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
Yes, i can. but i would like to solve this one!
– Goendg
Nov 13 at 15:46
add a comment |
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>
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
add a comment |
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>
:) actualy the problem was the angular varsion. I had an old one. thx
– Goendg
Nov 13 at 15:51
add a comment |
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>
:) actualy the problem was the angular varsion. I had an old one. thx
– Goendg
Nov 13 at 15:51
add a comment |
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>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>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
add a comment |
:) 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
add a comment |
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
Yes, i can. but i would like to solve this one!
– Goendg
Nov 13 at 15:46
add a comment |
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
Yes, i can. but i would like to solve this one!
– Goendg
Nov 13 at 15:46
add a comment |
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
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 at 15:31
BartoszTermena
36316
36316
Yes, i can. but i would like to solve this one!
– Goendg
Nov 13 at 15:46
add a comment |
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
add a comment |
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>
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
add a comment |
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>
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
add a comment |
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>
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>
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
add a comment |
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
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.
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.
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