diff --git a/src/main/java/com/application/DB/DB.java b/src/main/java/com/application/DB/DB.java
index ca1ceb1cd18cc120df764b1ce11ad9d60b481efd..600fb7c3fe7f0db4885c41699a6ff4ca0f6e0a1d 100644
--- a/src/main/java/com/application/DB/DB.java
+++ b/src/main/java/com/application/DB/DB.java
@@ -24,7 +24,12 @@ import java.util.*;
 public class DB {
 
     private static Job queryJob;
-    private static SimpleDateFormat dateFormat;
+
+    private static SimpleDateFormat getDateFormat(){
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+        dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
+        return dateFormat;
+    }
 
     /**
      * Retrieves the credentials file
@@ -46,7 +51,9 @@ public class DB {
     }
 
     public static void main(String[] args) throws Exception {
-        getKwh();
+        //getKwh();
+        //getName();
+        getZeroPointDate();
     }
 
 
@@ -106,15 +113,11 @@ public class DB {
         // Initializing the data map to store the results
         Map<String, Number> data = new HashMap<>();
 
-        // Initializing the date format
-        DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
-        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-
         // Preparing a query statement
         final String sqlStatement = "SELECT TimeStamp, VariantValue " +
                 "FROM sf-drying-optimization.124.int_sd_winccsensordata " +
-                "WHERE TimeStamp BETWEEN \"2021-01-25 08:51:03\" " +
-                "AND \"2021-01-28 11:10:09\" ORDER BY TimeStamp ASC";
+                "WHERE TimeStamp BETWEEN \"2021-01-30 08:51:03\" " +
+                "AND \"2021-02-15 11:10:09\" ORDER BY TimeStamp ASC";
 
         // Creates a job configuration
         queryJob = getJob(QueryJobConfiguration.newBuilder(sqlStatement).build());
@@ -130,35 +133,19 @@ public class DB {
             // Retrieving the wanted data
             long timeStamp = row.get("TimeStamp").getTimestampValue()/1000;
             // Riktig format, men i string
-            String formatedTimeStamp = dateFormat.format(timeStamp);
-            // Format the date to LocalDateTime datatype
-            LocalDateTime date = LocalDateTime.parse(formatedTimeStamp, format);
-            // Creates a future date to compare against
-            LocalDateTime dateFuture = date.plusDays(1);
-
-            //System.out.println(date);
+            String formatedTimeStamp = getDateFormat().format(timeStamp);
 
+            // Adding the data to a list in order to sort through later
             data.put(formatedTimeStamp, variantValue);
         }
-/*
-        NavigableMap<String, Number> sortedData = new TreeMap<>(data);
-
-        for (Map.Entry<String, Number> entry : sortedData.entrySet()) {
-            String key = entry.getKey();
-            String next = sortedData.higherEntry(entry.getKey()).getKey(); // next
-
-            //System.out.println("Nå: "+key);
-            //System.out.printf("Neste: %s\n\n",next);
-        }
 
- */
+        //NavigableMap<String, Number> sortedData = new TreeMap<>(data);
             return data;
     }
 
     /**
      * Retrieves information about kwh and the corresponding date
      *
-     * @return the results
      * @throws Exception returns potential error
      */
     public static void getName() throws Exception {
@@ -167,12 +154,6 @@ public class DB {
         Map<Object,ArrayList<Object>> data = new HashMap<>();
 
 
-        // Initializing the date format
-        DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
-        dateFormat.setTimeZone(TimeZone.getTimeZone("UTC"));
-
-
-
         // Preparing a query statement
         final String sqlStatement =
                         "SELECT Name, CalculatedStart, CalculatedStop FROM `sf-drying-optimization.124.int_dk_valmaticsdryingbatches`" +
@@ -193,15 +174,100 @@ public class DB {
             long calculatedStart = row.get("CalculatedStart").getTimestampValue()/1000;
             long calculatedStop = row.get("CalculatedStop").getTimestampValue()/1000;
             // Formatting the dates
-            String formattedCalculatedStart = dateFormat.format(calculatedStart);
-            String formattedCalculatedStop = dateFormat.format(calculatedStop);
+            String formattedCalculatedStart = getDateFormat().format(calculatedStart);
+            String formattedCalculatedStop = getDateFormat().format(calculatedStop);
 
             java.sql.Timestamp timestamp = new Timestamp(calculatedStart);
             //System.out.println(timestamp);
 
-            //System.out.printf("%s\t\t\t%s\t\t\t%s\n",name, formattedCalculatedStart, formattedCalculatedStop);
+            System.out.printf("%s\t\t\t%s\t\t\t%s\n",name, formattedCalculatedStart, formattedCalculatedStop);
 
         }
         //return data;
     }
+
+    private static void getZeroPointDate() throws Exception{
+
+        // Initializing a date format in the data type DateTimeFormatter
+        // Required for iterating through the dates.
+        DateTimeFormatter format = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
+
+        // Initializing the data map to store the results
+        Map<String, String> dates = new HashMap<>();
+
+        // Preparing a query statement
+        final String sqlStatement =
+                        "SELECT InTidTork, UtTidTork FROM `sf-drying-optimization.124.int_gs_ds_sipalpackages`" +
+                        "WHERE Tork Like \"%5%\" AND InTidTork BETWEEN \"2021-01-30 08:51:03\" " +
+                                "AND \"2022-03-15 11:10:09\" ORDER BY InTidTork ASC";
+
+        // Creates a job configuration
+        queryJob = getJob(QueryJobConfiguration.newBuilder(sqlStatement).build());
+
+        // Iterating through the results
+        TableResult result = queryJob.getQueryResults();
+        System.out.println("InTidTork\t\t\tUtTidTork");
+        for (FieldValueList row : result.iterateAll()) {
+
+            // Defining variables
+            String formatedInTidTork;
+            String formatedUtTidTork;
+
+            // Retrieving the wanted data
+            // InTidTork:
+            if(!row.get("InTidTork").isNull()){
+                long InTidTorkLong = row.get("InTidTork").getTimestampValue()/1000;
+                // Formating the data from long to a string in the correct date format
+                formatedInTidTork = getDateFormat().format(InTidTorkLong);
+            } else {
+                formatedInTidTork = "";
+            }
+
+            // UtTidTork:
+            if(!row.get("UtTidTork").isNull()){
+                long utTidTorkLong = row.get("UtTidTork").getTimestampValue()/1000;
+                // Formating the data from long to a string in the correct date format
+                formatedUtTidTork = getDateFormat().format(utTidTorkLong);
+            } else {
+                formatedUtTidTork = "";
+            }
+
+            dates.put(formatedInTidTork,formatedUtTidTork);
+            //System.out.printf("%s\t\t\t%s\n",formatedInTidTork,formatedUtTidTork);
+        }
+        NavigableMap<String, String> dataSet = new TreeMap<>(dates);
+
+       /*
+        for (Map.Entry<String, String> entry : dataSet.entrySet()) {
+            System.out.printf("Key: %s\t\t\tValue: %s\n",entry.getKey(),entry.getValue());
+        }
+        */
+
+        // Iterating through the data in order to find and set a zeropoint for the dates.
+        for (Map.Entry<String, String> entry : dataSet.entrySet()) {
+
+            // Retrieving the entry key
+            String key = entry.getKey();
+
+            // Format the date to LocalDateTime datatype
+            LocalDateTime date = LocalDateTime.parse(key, format);
+            // Creates a future date to compare against
+            LocalDateTime dateNowPlus = date.plusDays(1);
+            String formatedDateNowPlus = format.format(dateNowPlus);
+
+            try {
+                String next = dataSet.higherEntry(entry.getKey()).getKey(); // next
+
+                System.out.printf("Current date: %s\t\t\tPluss 1: %s\t\t\tNext date: %s\n",key,formatedDateNowPlus,next);
+
+                //System.out.printf("Neste: %s\n\n",next);
+                if(next.compareTo(formatedDateNowPlus) > 0){
+                    System.out.printf("Inni if!!@@, Er next mindre enn formated?\nNext, skal være større: %s\nFormated, skal være mindre: %s\n\n",next,formatedDateNowPlus);
+                }
+            } catch (NullPointerException e){
+                System.out.println(e.getMessage());
+            }
+        }
+
+    }
 }
\ No newline at end of file
diff --git a/target/classes/com/application/DB/DB.class b/target/classes/com/application/DB/DB.class
index f55cd733a771a5caab5806fc12243e1ebbed11d6..4f39a5616a61964b092c667dfb23974502bcd92a 100644
Binary files a/target/classes/com/application/DB/DB.class and b/target/classes/com/application/DB/DB.class differ