Time zones can be challenging to deal with, particularly in distributed teams and collaborations. In this capstone, you’ll implement an executable application that uses sbt to print the current time in a given time zone.
The goal of this capstone is to create a small program using sbt: it should start, ask the user to enter a time zone, use the input to compute the current time in it, and display the result in the terminal in a human-readable format, such as RFC 1123 (e.g., “Fri, 27 Apr 2018 11:44:35 +0200”). Let’s keep things simple and let the script crash if the user enters an invalid time zone; you’ll learn how to handle exceptions in the next unit.
First, you need to set up the sbt project. There are different ways of achieving this: you can create an sbt project using your IDE or apply the hello-world Giter8 template by typing the command sbt new scala/hello-world.g8
.
When using the hello-world Giter8 template do not forget to delete the Main.scala
file in the src/main/scala
folder. Alternatively, you can also create an empty sbt project manually as follows: