Reputation: 9584
I have the following code in my jsp. I use JSTL ${scheduledRideEndTime}
to retrieve the data.
<script>
var timeto2 = ${scheduledRideEndTime};
var hours3 = moment(timeto2).format("hh:mm a")
document.write(hours3);
</script>
If I hit Control Shift F
on eclipse the formatting changes to
<script>
var timeto2 = $
{
scheduledRideEndTime
};
var hours3 = moment(timeto2).format("hh:mm a")
document.write(hours3);
</script>
I then get syntax errors in my view. If I redo the code to "${scheduledRideEndTime}";
the Control Shift F
does not reformat the code, but view prints Invalid date
.
What am I missing here ? I want to be able to reformat code.
Upvotes: 0
Views: 49
Reputation: 580
Try this:
<script>
var timeto2 = parseInt("${scheduledRideEndTime}");
var hours3 = moment(timeto2).format("hh:mm a")
document.write(hours3);
</script>
Upvotes: 1