1
2
3
4
5
6 package net.stff.ical.util;
7
8 import java.text.SimpleDateFormat;
9 import java.util.Date;
10
11 /***
12 * @author buntekuh
13 *
14 * To change the template for this generated type comment go to
15 * Window - Preferences - Java - Code Generation - Code and Comments
16 */
17 public class Converters {
18
19 private Converters(){}
20
21
22 public static Date constructDate(String date, String time){
23
24 SimpleDateFormat df= new SimpleDateFormat("dd:MM:yyyy hh:mm");
25
26 try{
27 return df.parse(date+" "+time);
28 }
29 catch (Exception e){
30 return null;
31 }
32 }
33
34 /***
35 * Constructs a simple String representation of a date
36 * @param date The date to be converted
37 * @return
38 */
39 public static Date constructDate(String date){
40 SimpleDateFormat df= new SimpleDateFormat("dd:MM:yyyy");
41
42 try{
43 return df.parse(date);
44 }
45 catch (Exception e){
46 return null;
47 }
48 }
49
50 }