-
Notifications
You must be signed in to change notification settings - Fork 22
Description
While working with dates (without time), we faced a strange situation, where the date is being shifted one day before when stored. My belief is that the problem is related to the fact that, since it doesn't go with timestamp information, the system is considering it at 00:00. Since the system where this is stored is possibly behind (maybe PST?) and I'm on GMT, the date is stored shifted a day behind.
Using the Java 8 Time would avoid this problem, because the dates can be easily treated without timestamp, but the current version doesn't support it
I built a small project to demonstrate this issue and it's stored at https://github.com/ricardoalonso/smartsheet-java8-time and I'm also submitting a pull request to have the Java 8 Time support added to the SDK.
This is it's execution output:
ricardo.alonso@r3:~/git/smartsheet/smartsheet-java8-time$ mvn exec:java@java-date
[INFO] Scanning for projects...
[INFO]
[INFO] ------------< io.ricardoalonso.test:smartsheet-java8-time >-------------
[INFO] Building smartsheet-java8-time-test 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.6.0:java (java-date) @ smartsheet-java8-time ---
2025-08-27 10:10:10 INFO DefaultHttpClient:175 - GET https://api.smartsheet.com/2.0/sheets/8423189587644292, Response Code:200, Request completed in 596 ms
2025-08-27 10:10:10 INFO DefaultHttpClient:175 - GET https://api.smartsheet.com/2.0/sheets/8423189587644292, Response Code:200, Request completed in 384 ms
Loaded 0 rows from sheet: sample
Column name: Name, Type: TEXT_NUMBER
Column name: Date, Type: DATE
Current date: Wed Aug 27 10:10:10 BST 2025
Date to store: Tue Aug 26 00:00:00 BST 2025
Writing 1 rows back to sheet id 8423189587644292
2025-08-27 10:10:11 INFO DefaultHttpClient:175 - POST https://api.smartsheet.com/2.0/sheets/8423189587644292/rows, Response Code:200, Request completed in 1106 ms
Reading back the data to verify
2025-08-27 10:10:12 INFO DefaultHttpClient:175 - GET https://api.smartsheet.com/2.0/sheets/8423189587644292, Response Code:200, Request completed in 287 ms
Loaded 0 rows from sheet: sample
Row #1 (6191105089277828): Name="John Doe", Date="2025-08-25" (class java.lang.String, 6899774808346500 )
Done
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.201 s
[INFO] Finished at: 2025-08-27T10:10:12+01:00
[INFO] ------------------------------------------------------------------------
ricardo.alonso@r3:~/git/smartsheet/smartsheet-java8-time$ mvn exec:java@java8-time
[INFO] Scanning for projects...
[INFO]
[INFO] ------------< io.ricardoalonso.test:smartsheet-java8-time >-------------
[INFO] Building smartsheet-java8-time-test 1.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- exec-maven-plugin:1.6.0:java (java8-time) @ smartsheet-java8-time ---
2025-08-27 10:13:31 INFO DefaultHttpClient:175 - GET https://api.smartsheet.com/2.0/sheets/8423189587644292, Response Code:200, Request completed in 617 ms
2025-08-27 10:13:34 INFO DefaultHttpClient:175 - GET https://api.smartsheet.com/2.0/sheets/8423189587644292, Response Code:200, Request completed in 2948 ms
Loaded 1 rows from sheet: sample
Column name: Name, Type: TEXT_NUMBER
Column name: Date, Type: DATE
Current date: Wed Aug 27 10:13:34 BST 2025
Date to store: 2025-08-26
Writing 1 rows back to sheet id 8423189587644292
2025-08-27 10:13:37 INFO DefaultHttpClient:175 - POST https://api.smartsheet.com/2.0/sheets/8423189587644292/rows, Response Code:200, Request completed in 2379 ms
Reading back the data to verify
2025-08-27 10:13:37 INFO DefaultHttpClient:175 - GET https://api.smartsheet.com/2.0/sheets/8423189587644292, Response Code:200, Request completed in 268 ms
Loaded 1 rows from sheet: sample
Row #1 (6191105089277828): Name="John Doe", Date="2025-08-25" (class java.lang.String, 6899774808346500 )
Row #2 (8778258633789316): Name="John Doe", Date="2025-08-26" (class java.lang.String, 6899774808346500 )
Done
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 6.998 s
[INFO] Finished at: 2025-08-27T10:13:37+01:00
[INFO] ------------------------------------------------------------------------