All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.finmath.smartcontract.settlement.ZonedDateTimeAdapter Maven / Gradle / Ivy

There is a newer version: 1.0.6
Show newest version
package net.finmath.smartcontract.settlement;

import jakarta.xml.bind.annotation.adapters.XmlAdapter;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;

public class ZonedDateTimeAdapter extends XmlAdapter {

	@Override
	public String marshal(ZonedDateTime v) {
		return v.format(DateTimeFormatter.ofPattern("yyyyMMdd-HHmmss"));
	}

	@Override
	public ZonedDateTime unmarshal(String str) {
		DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd-HHmmss");
		LocalDateTime ldt = LocalDateTime.parse(str, formatter);
		return ZonedDateTime.of(ldt, ZoneId.systemDefault());
	}
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy