class Oadr20bFactory {

	public static String millisecondToXmlDuration(Long millisecond) {
		Duration newDuration = datatypeFactory.newDuration(millisecond);
		if (millisecond.equals(0L)) {
			return "PT0S";
		}
		StringBuilder builder = new StringBuilder();
		builder.append("P");

		if (newDuration.getDays() > 0) {
			builder.append(newDuration.getDays());
			builder.append("D");
		}
		if (newDuration.getHours() > 0 || newDuration.getMinutes() > 0 || newDuration.getSeconds() > 0) {
			builder.append("T");
			if (newDuration.getHours() > 0) {
				builder.append(newDuration.getHours());
				builder.append("H");
			}
			if (newDuration.getMinutes() > 0) {
				builder.append(newDuration.getMinutes());
				builder.append("M");
			}

			if (newDuration.getSeconds() > 0) {
				builder.append(newDuration.getSeconds());
				builder.append("S");
			}
		}

		return builder.toString();
	}

	private  Oadr20bFactory();

}