Java tutorial
//package com.java2s; public class Main { public static int parseDay(String date) { String[] time = date.split("-"); int year = Integer.parseInt(time[0]); int month = Integer.parseInt(time[1]); int day = Integer.parseInt(time[2]); int[] months = { 0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 365 }; int test = year * 365 + month * months[month] + day; return year * 365 + months[month] + day; } }