import java.time.Instant;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Locale;

public class Main {
	public static void main(String args[]) {
		// Change the ZoneId to the applicable one e.g. ZoneId.of("Etc/UTC")
		DateTimeFormatter dtfInput = DateTimeFormatter.ofPattern("uuuu-MM-dd HH:mm:ss.SSS", Locale.ENGLISH)
										.withZone(ZoneId.systemDefault());

		Instant instant = Instant.from(dtfInput.parse("2021-09-29 09:35:07.531"));
		System.out.println(instant);
	}
}