fork download
  1. // from https://i...content-available-to-author-only...e.com/TaR29j
  2. /* package whatever; // don't place package name! */
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6. import java.util.Date;
  7. import java.text.SimpleDateFormat;
  8. import java.text.*;
  9.  
  10. /* Name of the class has to be "Main" only if the class is public. */
  11. class TimeSheet
  12. {
  13. public static void main (String[] args) throws java.lang.Exception
  14. {
  15. //Scanner myObj = new Scanner(System.in); // Create a Scanner object
  16.  
  17. Scanner myObj = new Scanner(System.in); // use myObj so you don't have to change it if you choose to use hard-wired inputs
  18.  
  19. // https://w...content-available-to-author-only...t.com/how-to-format-date-using-printf-method-in-java
  20. Date dateObj = new Date();
  21.  
  22. // https://stackoverflow.com/posts/39066917/revisions
  23. SimpleDateFormat sdf = new SimpleDateFormat("EEE MMM d, yyyy");
  24.  
  25. System.out.println("From \"https://c...content-available-to-author-only...e.com/pwm/action/mobileGetTimesheetPunches\"");
  26.  
  27. //stackoverflow/questions/2296685/how-to-read-input-with-multiple-lines-in-java
  28. //stackoverflow/questions/56887493/how-to-take-multi-line-input-in-java search:HashmatWarrior
  29. while(myObj.hasNext())
  30. {
  31. String gottaFix = myObj.nextLine();
  32. String[] dateString = new String[2];
  33. String header = "Type Status Time Hours";
  34. String hours;
  35. String[] punch = new String[4];
  36.  
  37. if(!gottaFix.isEmpty())
  38. {
  39. if(gottaFix.contains("Punches:"))
  40. {
  41. dateString = gottaFix.split(": ");
  42. dateObj = sdf.parse(dateString[1]);
  43.  
  44. System.out.printf("%ta", dateObj); // Sun
  45. System.out.printf(" %tm", dateObj); // date
  46. System.out.printf("/%te", dateObj); // date
  47.  
  48. System.out.print(", scheduledTime");
  49.  
  50. /*System.out.printf("Date: %td%n", dateObj); System.out.printf("Month: %tm%n", dateObj); System.out.printf("Year: %ty%n", dateObj); System.out.printf("getTime(): "+dateObj);*/
  51. }
  52.  
  53. else if(gottaFix.contains("M"))
  54. {
  55. punch = gottaFix.split("\t");
  56. System.out.print(", ");
  57. System.out.print(punch[3].replaceAll(" \\DM", ""));
  58.  
  59. if(punch[0].equals("ES"))
  60. {
  61. if(punch[1].equals("Edited"))
  62. { System.out.println("/, (bank run); ");}
  63. else
  64. { System.out.println(", no bank run; ");}
  65. }
  66. }
  67. }
  68.  
  69. //else
  70. {
  71.  
  72. }
  73. }
  74. }
  75. }
Success #stdin #stdout 0.25s 58076KB
stdin
Punches: Thu Nov 27, 2025
Type	Store	Status	Time	Hrs
SS	03660	Normal	12:18 PM	4:33
SB	03660	Normal	4:51 PM	0:11
EB	03660	Normal	5:02 PM	0:29
ES	03660	Normal	5:31 PM	
Punches: Fri Nov 28, 2025
Type	Store	Status	Time	Hrs
SS	03660	Normal	5:30 PM	4:35
SB	03660	Normal	10:05 PM	0:18
EB	03660	Normal	10:23 PM	0:29
ES	03660	Normal	10:52 PM	
Punches: Sat Nov 29, 2025
Type	Store	Status	Time	Hrs
SS	03660	Normal	5:19 PM	4:44
SB	03660	Normal	10:03 PM	0:11
EB	03660	Normal	10:14 PM	0:22
ES	03660	Normal	10:36 PM	
Punches: Sun Nov 30, 2025
Type	Store	Status	Time	Hrs
SS	03660	Normal	5:13 PM	4:56
SB	03660	Normal	10:09 PM	0:15
EB	03660	Normal	10:24 PM	0:10
ES	03660	Normal	10:34 PM	
Punches: Mon Dec 1, 2025
Type	Store	Status	Time	Hrs
SS	03660	Normal	5:34 PM	3:48
SB	03660	Normal	9:22 PM	0:13
EB	03660	Normal	9:35 PM	0:48
ES	03660	Normal	10:23 PM	
Punches: Tue Dec 2, 2025
Type	Store	Status	Time	Hrs
SS	03660	Normal	5:30 PM	4:30
SB	03660	Normal	10:00 PM	0:13
EB	03660	Normal	10:13 PM	0:20
ES	03660	Normal	10:33 PM	
Punches: Fri Dec 5, 2025
Type	Store	Status	Time	Hrs
SS	03660	Normal	5:30 PM	4:36
SB	03660	Normal	10:06 PM	0:18
EB	03660	Normal	10:24 PM	0:27
ES	03660	Normal	10:51 PM	
Punches: Sat Dec 6, 2025
Type	Store	Status	Time	Hrs
SS	03660	Normal	5:30 PM	4:31
SB	03660	Normal	10:01 PM	0:11
EB	03660	Normal	10:12 PM	0:23
ES	03660	Normal	10:35 PM	
Punches: Sun Dec 7, 2025
Type	Store	Status	Time	Hrs
SS	03660	Normal	3:52 PM	6:03
SB	03660	Normal	9:55 PM	0:12
EB	03660	Normal	10:07 PM	0:24
ES	03660	Normal	10:31 PM	
stdout
From "https://c...content-available-to-author-only...e.com/pwm/action/mobileGetTimesheetPunches"
Thu 11/27, scheduledTime, 12:18, 4:51, 5:02, 5:31, no bank run; 
Fri 11/28, scheduledTime, 5:30, 10:05, 10:23, 10:52, no bank run; 
Sat 11/29, scheduledTime, 5:19, 10:03, 10:14, 10:36, no bank run; 
Sun 11/30, scheduledTime, 5:13, 10:09, 10:24, 10:34, no bank run; 
Mon 12/1, scheduledTime, 5:34, 9:22, 9:35, 10:23, no bank run; 
Tue 12/2, scheduledTime, 5:30, 10:00, 10:13, 10:33, no bank run; 
Fri 12/5, scheduledTime, 5:30, 10:06, 10:24, 10:51, no bank run; 
Sat 12/6, scheduledTime, 5:30, 10:01, 10:12, 10:35, no bank run; 
Sun 12/7, scheduledTime, 3:52, 9:55, 10:07, 10:31, no bank run;