-3

I am using angular-moment-picker to pick time ( hours and minutes ). I got the time in this format HH:mm as it is shown in my source code below:

<div class="form-group"> <p class="icon-group input-group "> <input readonly ng-model="workTime.startTime" class="form-control"> <span class="input-group-btn "> <button moment-picker="startTime" format="HH:mm" type="button" class="btn btn-default" id="startTime"> <i aria-hidden="true" class="glyphicon glyphicon-calendar"></i> </button> </span> <span class="show-date-picker"></span> </p> </div> 

After that i formatted it in date format like that:

var startDate=new Date(); var start=$scope.startTime.toString().trim().split(':'); startDate.setHours(start[0]); startDate.setMinutes(start[1]); startDate.setSeconds(0); 

I got the date in this format:

Mon, 05 Jun 2017 12:00:00 GMT

whenever I store this date in oracle database I got Mon, 05 Jun 2017 11:00:00 GMT

Can someone explain to me why the time is reduced by one hour.

Thank you

5
  • 1
    and why down vote, can you expain ?? Commented Jun 5, 2017 at 16:18
  • 1
    I didn't down vote you, but I'm willing to bet it's because the question in itself shows you have made no effort to research things yourself. Any simple search for keywords such as javascript date convert gmt would have given you a handful of answers. Commented Jun 5, 2017 at 16:27
  • @ippi thank for answering, Yeah maybe if it seems to the voter but me I already tested, and I already saw this issue but doesn't help me to solve my issue. Regards Commented Jun 5, 2017 at 16:27
  • @ippi thanks, Javascript date convert gmt already looked for, I found toGMTString() ad doesn't work for me. Regards Commented Jun 5, 2017 at 16:29
  • @ippi can you reread my issue i have updated it Commented Jun 5, 2017 at 20:58

1 Answer 1

2

You can display your date on UTC like this:

const date = new Date(); console.log(date.toUTCString()); 
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for your answer, I have updated my issue

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.