fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. import java.time.* ;
  8. import java.time.format.* ;
  9. import java.time.temporal.* ;
  10. import java.time.chrono.* ;
  11. import java.time.zone.* ;
  12.  
  13.  
  14. /* Name of the class has to be "Main" only if the class is public. */
  15. class Ideone
  16. {
  17. public static void main (String[] args) throws java.lang.Exception
  18. {
  19.  
  20. System.out.println(
  21.  
  22. OffsetDateTime
  23. .parse(
  24. "20200519T142616Z" ,
  25. DateTimeFormatter.ofPattern( "uuuuMMdd'T'HHmmssXXXXX" )
  26. )
  27. .format(
  28. DateTimeFormatter
  29. .ofLocalizedDateTime( FormatStyle.MEDIUM )
  30. .withLocale( Locale.UK )
  31. )
  32.  
  33. );
  34.  
  35. System.out.println(
  36.  
  37. OffsetDateTime
  38. .parse(
  39. "20200519T142616Z" ,
  40. DateTimeFormatter.ofPattern( "uuuuMMdd'T'HHmmssXXXXX" )
  41. )
  42. .atZoneSameInstant(
  43. ZoneId.of( "Europe/Minsk" )
  44. )
  45. .format(
  46. DateTimeFormatter
  47. .ofLocalizedDateTime( FormatStyle.MEDIUM )
  48. .withLocale( new Locale( "ru" , "RU" ) )
  49. )
  50.  
  51. );
  52.  
  53. }
  54. }
Success #stdin #stdout 0.2s 40376KB
stdin
Standard input is empty
stdout
19 May 2020, 14:26:16
19 мая 2020 г., 17:26:16