1 /* |
1 /* |
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
316 { |
316 { |
317 try |
317 try |
318 { |
318 { |
319 Calendar cal = Calendar.getInstance(); |
319 Calendar cal = Calendar.getInstance(); |
320 cal.set(Calendar.YEAR, Integer.parseInt(str.substring(0,4))); |
320 cal.set(Calendar.YEAR, Integer.parseInt(str.substring(0,4))); |
321 cal.set(Calendar.MONTH, Integer.parseInt(str.substring(4,6))); |
321 // Calendar.MONTH begins from 0 (0=January, 1=Februrary, ...) |
322 cal.set(Calendar.DAY_OF_WEEK, Integer.parseInt(str.substring(6,8))); |
322 cal.set(Calendar.MONTH, Integer.parseInt(str.substring(4,6)) - 1); |
|
323 cal.set(Calendar.DAY_OF_MONTH, Integer.parseInt(str.substring(6,8))); |
323 cal.set(Calendar.HOUR, Integer.parseInt(str.substring(8,10))); |
324 cal.set(Calendar.HOUR, Integer.parseInt(str.substring(8,10))); |
324 cal.set(Calendar.MINUTE, Integer.parseInt(str.substring(10,12))); |
325 cal.set(Calendar.MINUTE, Integer.parseInt(str.substring(10,12))); |
325 cal.set(Calendar.SECOND, Integer.parseInt(str.substring(12,14))); |
326 cal.set(Calendar.SECOND, Integer.parseInt(str.substring(12,14))); |
326 return cal.getTime(); |
327 return cal.getTime(); |
327 } |
328 } |