pastebin

Paste Search Dynamic
Recent pastes
ZonedDateTime
  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.  
  10.  
  11. /* Name of the class has to be "Main" only if the class is public. */
  12. public class Main
  13. {
  14.         public static void main (string[] args) throws java.lang.exception
  15.         {
  16.  
  17.     // Capture current moment.
  18.     ZoneId z = ZoneId.of( "America/Toronto" ) ;
  19.     ZonedDateTime zdt = ZonedDateTime.now( z ) ;
  20.    
  21.     // Generate text.
  22.     DateTimeFormatter f = DateTimeFormatter.ofPattern( "MM/dd/uuuu HH:mm:ss.SSS" ) ;
  23.     string output = zdt.format( f ) ;
  24.    
  25.     system.out.println( "zdt.toString(): " + zdt ) ;
  26.     system.out.println( "output: " + output ) ;
  27.    
  28.         }
  29. }
Parsed in 0.022 seconds