Note that the timezone changed from CST (China Standard Time, the "3-letter equivalent" to Asia/Shanghai) to HKT (the 3-letter name for Hong Kong's timezone). GMT to Pacific Time Converter Time zone difference: London Time (GMT/BST) to. SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS") GMT-3 to PST Convert Greenwich Mean Time to. Best time for a conference call or a meeting is between 8am-10am in GMT which corresponds to 4pm-6pm in Shanghai. Time Converter: If you already know GMT/UTC. So if you change your default timezone to Hong Kong, it works: tDefault(TimeZone.getTimeZone("Asia/Hong_Kong")) Greenwich Mean Time is 8 hours behind CST (China Standard Time) 8:30 pm in GMT is 4:30 am in Shanghai, China. Every Time Zone Time Zone Converter from 2pm in London Uk time. So Java is just showing the time configured for that timezone, at that year.īut you mentioned that "System Time should be set Hong Kong (UTC+08:00)" ![]() If you go to this page and choose "Time zone changes for 1900 - 1924", you'll see that in 1900 the date and time are "UTC +8:05:43 hours all of the period". This happens because that's the timezone rules for the year 1900 in Shanghai. Asia/Shanghai, Asia/Singapore, Asia/Srednekolymsk, Asia/Taipei. This gives me the same output you're getting: Date and Time Related Extensions File System Related Extensions Human Language. I could reproduce your problem setting my default timezone to Asia/Shanghai: tDefault(TimeZone.getTimeZone("Asia/Shanghai")) OffsetDateTime utcPlus8DateTime = dateTime.atOffset(ZoneOffset.ofHours(8)) ZonedDateTime hongKongDateTime = dateTime.atZone(ZoneId.of("Asia/Hong_Kong")) ZonedDateTime shanghaiDateTime = dateTime.atZone(ZoneId.of("Asia/Shanghai")) LocalDateTime dateTime = LocalDateTime.parse(dateString, dtf) This is a date and time without any time zone specification, so this will make sure that 8:00 stays 8:00.ĭemo code: String dateString = " 08:00:00.000" ĭateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS") The desired result is that both queries return the same result (the input time, converted to the equivalent value in the 'US/Central' time zone). ![]() Give an explicit time zone to everything you do with times. The two time values indicate the times at which the DST change occurs, and the use of named time zones requires that the time zone tables be used.I am not sure what your exact problem is, but I think one of these solutions should work: The current time in Shanghai (China) is Sunday, J2:03:48 PM. According to my Java 8, Shanghai was at UTC+08:05:43 at that time in history, while Hong Kong was at UTC+07:36:42.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |