javascript - DatePicker Error in Angular JS due to UTC -


I selected the UI on 12 September 2014.

The following code is

  ctrl. $ Formatters.push (function (modelValue) {console.log (modelValue); var dt = new date (model value); dt.setMinutes (dt.getMinutes () + dt.getTimezoneOffset ()); Console.log (dt) Return dt;});   

I see the following two console logs.

  1. 09/11/2014
  2. Mercury's 10 September 2014 18:30: GMT + 0530 (IST)

    Why is not conversion done properly from UTC locally

    thanks in advance

    It is not clear what you are trying to do is not time in the input. Do you want to add the present time of the day to arbitrary date? Or do you just want a local representation of the date?

    dt.setMinutes (...) and replace all three rows, instead of the following two lines:

      return dt. ToLocaleDateString ();   

    If you are still trying to decide which date is the input (I do not know why ...) but you can try:

      dt.setTime (new date (.) GetTime ());  setMinutes (...)  instead of the line   

    .

    Then you return to dt.toLocaleString;

    All date objects are stored in milliseconds in the same way as in 1972. The best way to use created date object methods is to find out what you want from it. for reference.

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -