"jsf converter timestamp" Code Answer


bind to date#gettime() instead to get/set the raw timestamp in milliseconds.

<h:inputtext value="#{bean.date.time}" />

or if you want to input/output a human readable date, then just stick to using #{bean.date} and use the standard date converters.

<h:inputtext value="#{bean.date}">
    <f:convertdatetime type="date" datetype="short" />

in the backend just use date#gettime() to process the timestamp.

update: you shouldn't clutter your model with jdbc specific api. the java.util.date represents the timestamp. use java.sql.timestamp only at that point you're about to persist a java.util.date in a timestamp or datetime column of your db.

preparedstatement.settimestamp(index, new timestamp(bean.getdate().gettime()));
By sbranturesh on August 2 2022

Answers related to “jsf converter timestamp”

Only authorized users can answer the Search term. Please sign in first, or register a free account.