88import com .cronutils .model .definition .CronDefinitionBuilder ;
99import com .cronutils .model .time .ExecutionTime ;
1010import com .cronutils .parser .CronParser ;
11- import org .joda .time .DateTime ;
12- import org .joda .time .Duration ;
1311
12+ import java .time .Duration ;
13+ import java .time .ZonedDateTime ;
1414import java .util .Locale ;
1515
1616import static com .cronutils .model .CronType .QUARTZ ;
@@ -87,7 +87,7 @@ public static void main(String[] args) {
8787 //We have a scheduling service, and would like to display previous/next execution
8888 //or time from last or to next execution. Can cron-utils help us with that? Sure!
8989 //Given a Cron instance, we can ask for next/previous execution
90- DateTime now = DateTime .now ();
90+ ZonedDateTime now = ZonedDateTime .now ();
9191 ExecutionTime executionTime = ExecutionTime .forCron (parsedQuartzCronExpression );
9292 System .out .println (
9393 String .format (
@@ -107,13 +107,13 @@ public static void main(String[] args) {
107107 System .out .println (
108108 String .format (
109109 "Given the Quartz cron '%s' and reference date '%s', last execution was %s seconds ago" ,
110- parsedQuartzCronExpression .asString (), now , timeFromLastExecution .toStandardSeconds (). getSeconds ()
110+ parsedQuartzCronExpression .asString (), now , timeFromLastExecution .getSeconds ()
111111 )
112112 );
113113 System .out .println (
114114 String .format (
115115 "Given the Quartz cron '%s' and reference date '%s', next execution will be in %s seconds" ,
116- parsedQuartzCronExpression .asString (), now , timeToNextExecution .toStandardSeconds (). getSeconds ()
116+ parsedQuartzCronExpression .asString (), now , timeToNextExecution .getSeconds ()
117117 )
118118 );
119119
0 commit comments