datetime - java 8 Instant.now() is showing wrong instant time -


in java 8 instant.now() method showing wrong time . code looks :

import java.time.*; import java.time.temporal.*; public class datetimedemo{     public static void main(string []args){             instant = instant.now();             system.out.println(now);         }      } 

its date part correct time part .

eg

2016-07-11t11:01:25.498z in system 4.31 pm

i using asia/calcutta timezone

that's correct time. note "z" @ end, indicating utc - 11:01:25 in utc 16:31:25 in asia/calcutta.

if want represent "now" in default time zone, use zoneddatetime.now() instead.


Comments

Popular posts from this blog

sql - invalid in the select list because it is not contained in either an aggregate function -

Angularjs unit testing - ng-disabled not working when adding text to textarea -

How to start daemon on android by adb -