Changeset 469 for tapas/common
- Timestamp:
- 04/06/12 16:09:10 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
tapas/common/implementation/com/ether/DateHelper.java
r376 r469 1 1 package com.ether; 2 3 import org.apache.commons.logging.Log; 4 import org.apache.commons.logging.LogFactory; 5 import org.jetbrains.annotations.NotNull; 6 import org.jetbrains.annotations.Nullable; 2 7 3 8 import java.text.DateFormat; … … 7 12 import java.util.Date; 8 13 import java.util.Locale; 9 10 import org.apache.commons.logging.Log;11 import org.apache.commons.logging.LogFactory;12 import org.jetbrains.annotations.Nullable;13 14 14 15 /** … … 132 133 133 134 @Nullable 134 public static Date parseDate( @Nullable final String date, final String format ) throws ParseException 135 public static Date parseDate( @Nullable final String date, final String format ) 136 throws ParseException 135 137 { 136 138 if( date == null ) 137 139 return null; 138 140 139 141 final SimpleDateFormat simpleDateFormat = new SimpleDateFormat( format ); 140 return simpleDateFormat.parse(date); 142 return simpleDateFormat.parse( date ); 143 } 144 145 /** 146 * This method add some hours to a date 147 * 148 * @param date 149 * @param hoursNumber 150 * @return 151 */ 152 public static Date addHourToDate( @NotNull final Date date, @NotNull final Integer hoursNumber ) 153 { 154 final Calendar calendar = Calendar.getInstance(); 155 calendar.setTime( date ); 156 calendar.add( Calendar.HOUR, hoursNumber ); 157 return calendar.getTime(); 141 158 } 142 159 143 160 private static final Log LOGGER = LogFactory.getLog( DateHelper.class ); 144 161 145 162 public static final String FRENCH_DATE_PATTERN_SHORT = "dd/MM/yyyy"; 146 163 public static final String ENGLISH_DATE_PATTERN_SHORT = "yyyy-MM-dd";
Note: See TracChangeset
for help on using the changeset viewer.