From 40e77eea8328ff9cef8d45b2ff3134349d7a65af Mon Sep 17 00:00:00 2001 From: Andreas Fitzek Date: Wed, 15 Oct 2014 10:18:41 +0200 Subject: Signingdate added Timezone konfiguration #42 --- .../at/gv/egiz/pdfas/lib/impl/stamping/ValueResolver.java | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'pdf-as-lib') diff --git a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/ValueResolver.java b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/ValueResolver.java index fc3ffef3..fd7bb0dd 100644 --- a/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/ValueResolver.java +++ b/pdf-as-lib/src/main/java/at/gv/egiz/pdfas/lib/impl/stamping/ValueResolver.java @@ -25,6 +25,7 @@ package at.gv.egiz.pdfas.lib.impl.stamping; import java.text.SimpleDateFormat; import java.util.Calendar; +import java.util.TimeZone; import java.util.regex.Matcher; import java.util.regex.Pattern; @@ -47,7 +48,7 @@ public class ValueResolver implements IProfileConstants, IResolver { public static final String PatternRegex = "\\$(\\{[^\\$]*\\})"; - public static final String defaultDateFormat = "yyyy-MM-dd'T'HH:mm:ss.SSSZ"; + public static final String defaultDateFormat = "yyyy-MM-dd'T'HH:mm:ssXXX"; public static final String EXP_START = "${"; public static final String EXP_END = "}"; @@ -69,11 +70,17 @@ public class ValueResolver implements IProfileConstants, IResolver { if (value == null) { value = defaultDateFormat; } + // Value holds the date format! - SimpleDateFormat formater = new SimpleDateFormat(value); - //formater.setTimeZone(TimeZone.getTimeZone("UTC")); + // + SimpleDateFormat fdf = new SimpleDateFormat(value); + String timeZone = settings.getProfileTimeZone(); + + if(timeZone != null) { + fdf.setTimeZone(TimeZone.getTimeZone("timeZone")); + } Calendar cal = Calendar.getInstance(); - return formater.format(cal.getTime()); + return fdf.format(cal.getTime()); } if (value != null) { -- cgit v1.2.3