I am trying to display timestamp using angular. At the backend on console log I am getting date like this 2020-09-03 00:00:00.0 but when I trying to get date at frontend it is displaying like this 1600021800000. How can I display date in regular format?
This how I get date on console using spring boot -
And when get it at frontend it display like this -
How can I display date like this 2020-09-03 00:00:00.0?
Suppose your date is in $scope.dateTime
<p>{{dateTime | date:'yyyy-MM-dd HH:mm:ss.sss'}}</p>
Just put this wherever you want to show your formatted date in your HTML. Look up angularjs date api for more information regarding formatting
Related
I'm doing a Angular Wordpress theme and displaying the date on posts using {{post.date}} . This displays the date as it is in the WP REST API as 2017-07-17T12:48:51 . I am wanting to display the date as July 7, 2017 .I've tried changing the date in the general settings date format but that did not affect the display of the date.
use filter like following:
{{post.date | date}}
I am using angular DateTime Picker. i am using $uibModel to show a pop up and couple of fields are there for updatind data. I am using
bootstrap-ui-datetime-picker
this date to add atetime picker. I am passing JSON and I am displaying in corresponding fields. My date format is
2016-02-19T10:55:33+00:00
and My format I am using in input field is
datetime-picker="yyyy-MM-ddTHH:mm:ss:sssZ"
as per the docs. But I am not getting the model reflected in the text box. If I remove the format in input field I get the model displayed there. Why is this happening? i have given the same format as the value to format input. Thanks.
Using Open Graph downloading the events from facebook.
I gets start event in format: 2015-10-24T18:00:00+0200. How to use a separate date on the day, month and hour using angularjs?
That's a T format date and can just be used as a regular date object with
var d = new Date("2015-10-24T18:00:00+0200");
See the Date object reference for methods
https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Date
I have the following datetime:
2015-03-04T00:00:39+00:00
I am trying to display the date as follows using AngularJS
{{entry.entryDate | date:'MM/dd'}}
However, when I do this, it displays 03/03 instead of 03/04.
The date displays correctly for any time before 1900. But when a datetime is 1900 or later, it always displays 03/03 instead of 03/04.
Any idea how I can fix this?
According to AngularJS documentation you can find here , you can set timezone as shown below.
{{ date_expression | date : format : timezone}}
I ended up creating a custom filter to format in utcTime. This SO question helped point me in the right direction.
Why is Angular date filter displaying wrong date?
How can I properly render exclusively end date from the Drupal 7 Date field in template file?
$node->field_start_date[LANGUAGE_NONE][0]` (is it correct?)
I can get to raw values but I want it to get formatted etc.
You can use the code below:
drupal_render(field_view_field('node', $node, 'field_end_datetime'));
field_view_field: https://api.drupal.org/api/drupal/modules!field!field.module/function/field_view_field/7