Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
SmartTime
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Robert Goldmann
SmartTime
Commits
270a92ce
Commit
270a92ce
authored
8 years ago
by
Robert Goldmann
Browse files
Options
Downloads
Patches
Plain Diff
Fixed
#2
- shown time difference is wrong
parent
f37b2d44
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/userInterface/InsertTimeController.java
+3
-11
3 additions, 11 deletions
src/userInterface/InsertTimeController.java
with
3 additions
and
11 deletions
src/userInterface/InsertTimeController.java
+
3
−
11
View file @
270a92ce
...
@@ -7,7 +7,6 @@ import java.text.SimpleDateFormat;
...
@@ -7,7 +7,6 @@ import java.text.SimpleDateFormat;
import
java.time.Duration
;
import
java.time.Duration
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.time.LocalDateTime
;
import
java.time.LocalDateTime
;
import
java.time.Period
;
import
java.time.format.DateTimeFormatter
;
import
java.time.format.DateTimeFormatter
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.Collections
;
...
@@ -30,6 +29,7 @@ import javafx.stage.Stage;
...
@@ -30,6 +29,7 @@ import javafx.stage.Stage;
import
javafx.util.Callback
;
import
javafx.util.Callback
;
import
logger.Logger
;
import
logger.Logger
;
import
tools.AlertGenerator
;
import
tools.AlertGenerator
;
import
tools.ConvertTo
;
public
class
InsertTimeController
public
class
InsertTimeController
{
{
...
@@ -371,8 +371,6 @@ public class InsertTimeController
...
@@ -371,8 +371,6 @@ public class InsertTimeController
int
minutes2
=
timePicker2Controller
.
getMinutes
();
int
minutes2
=
timePicker2Controller
.
getMinutes
();
int
seconds2
=
timePicker2Controller
.
getSeconds
();
int
seconds2
=
timePicker2Controller
.
getSeconds
();
int
days
=
Period
.
between
(
datePicker1
.
getValue
(),
datePicker2
.
getValue
()).
getDays
();
String
dateString
=
datePicker1
.
getValue
().
getYear
()
+
"-"
+
getCorrectedString
(
datePicker1
.
getValue
().
getMonthValue
())
+
"-"
+
getCorrectedString
(
datePicker1
.
getValue
().
getDayOfMonth
())
+
"-"
+
getCorrectedString
(
hours1
)
+
":"
+
getCorrectedString
(
minutes1
)
+
":"
+
getCorrectedString
(
seconds1
);
String
dateString
=
datePicker1
.
getValue
().
getYear
()
+
"-"
+
getCorrectedString
(
datePicker1
.
getValue
().
getMonthValue
())
+
"-"
+
getCorrectedString
(
datePicker1
.
getValue
().
getDayOfMonth
())
+
"-"
+
getCorrectedString
(
hours1
)
+
":"
+
getCorrectedString
(
minutes1
)
+
":"
+
getCorrectedString
(
seconds1
);
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd-HH:mm:ss"
);
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
"yyyy-MM-dd-HH:mm:ss"
);
LocalDateTime
dateTime
=
LocalDateTime
.
parse
(
dateString
,
formatter
);
LocalDateTime
dateTime
=
LocalDateTime
.
parse
(
dateString
,
formatter
);
...
@@ -382,13 +380,7 @@ public class InsertTimeController
...
@@ -382,13 +380,7 @@ public class InsertTimeController
Duration
d
=
Duration
.
between
(
dateTime
,
dateTime2
);
Duration
d
=
Duration
.
between
(
dateTime
,
dateTime2
);
long
seconds
=
d
.
getSeconds
();
labelDuration
.
setText
(
ConvertTo
.
ConvertSecondsToTime
(
d
.
getSeconds
()));
int
finalHours
=
24
*
days
+
(
int
)(
seconds
/
(
60
*
60
))
%
24
;
int
finalMinutes
=
(
int
)
seconds
/
60
%
60
;;
int
finalSeconds
=
(
int
)
seconds
%
60
;
labelDuration
.
setText
(
""
+
finalHours
+
" h "
+
finalMinutes
+
" min "
+
finalSeconds
+
" sek"
);
}
}
public
boolean
isEndDateAfterStartDate
()
public
boolean
isEndDateAfterStartDate
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment