0

I am generating Continuity Of Care document that requires effective time. The document states:

CONF-9:     ClinicalDocument / effectiveTime SHALL be expressed with precision to include seconds.
CONF-10:    ClinicalDocument / effectiveTime SHALL include an explicit time zone offset.

Well, I can get current time in seconds:

long timeMillis = System.currentTimeMillis();
long timeSeconds = TimeUnit.MILLISECONDS.toSeconds(timeMillis);

But I have no idea what the second part says about having time zone. A example of correct effective time would be 20000407130000+0500. It is from one of the sample.

ntstha
  • 1,187
  • 4
  • 23
  • 41

1 Answers1

1

System.currentTimeMillis() is UTC by definition.

From the javadoc

the difference, measured in milliseconds, between the current time and midnight, January 1, 1970 UTC.

Just hard code UTC as the time zone for your timestamps.

Bohemian
  • 412,405
  • 93
  • 575
  • 722