Generating useful current-dateTime() values

setvalueOne common operation that you find yourself doing as a developer is time-stamping various operations. Creation DateTime, Save DateTime or Submission DateTime values are very useful when processing data. However, in Livecycle there are some small gotchas when dealing with system generated dateTime strings that they don’t make you aware of.
 

current-dateTime() default Timezone

Even in the latest help file for current-dateTime() XPath function, they don’t tell you that when you make a call to this function, it will always return the time string as GMT+0 no matter what timezone the server is running in. Now this is fine if you live in London, Burkina Faso or Tórshavn but no good if you live anywhere else in the world.

Adjusting the default

Adjusting this value to your default timezone is fairly easy as the format-dateTime() function does this for you if you feed it right. You just need to know what values to put in for the four optional fields and how to source them. Adobe give some help to the values on the Date and Time parameters help page and I will demonstrate using format-dateTime():

Syntax

format-dateTime(strDateTime, (language, country, variant, timezone)?)

Parameters

So, to get the real current-dateTime() string for an application based in Auckland, New Zealand you would do the following:

format-dateTime(current-dateTime(), "en", "NZ", "WIN", "Pacific/Auckland")

 

Advertisements

About Darren
I am a Senior Consultant and for BizTECH Enterprise Services (Australia) specialising in AEM Forms and Adobe LiveCycle, Document Services and Adobe Experience Manager.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

aemblog

Everything AEM aka CQ5 based on my experience listed here.

Adobe AEM The Right Way

Best practices, tips, and tricks for your Adobe AEM project

/home/bkondepudi

A WCM journey with Day/Adobe CQ

Technoracle (a.k.a. "Duane's World")

A multi-purpose toolkit for the Adobe LiveCycle and AEM Forms developer.

Adobe LiveCycle Blog

A multi-purpose toolkit for the Adobe LiveCycle and AEM Forms developer.

A multi-purpose toolkit for the Adobe LiveCycle and AEM Forms developer.

XFA@Mobile

A multi-purpose toolkit for the Adobe LiveCycle and AEM Forms developer.

Code Monkey

Ramblings of a Developer

%d bloggers like this: