Converting java.sql.timestamp to Json format
NickName:user6023611 Ask DateTime:2016-11-24T04:44:10

Converting java.sql.timestamp to Json format

I have a private java.sql.Timestamp myDate;
In some model (POJO) class. Is it possible to convert it (by jackson) to something like that:
Wed, 23 Nov 2016 20:37:09 GMT
?
I know that I may use something like @JsonProperty, however I can't deal with format of this one. Moreover, keep in mind that I not only send JSON, but also receive the same JSON.
Thank in advance!

Copyright Notice:Content Author:「user6023611」,Reproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/40773848/converting-java-sql-timestamp-to-json-format

More about “Converting java.sql.timestamp to Json format” related questions

Converting java.sql.timestamp to Json format

I have a private java.sql.Timestamp myDate; In some model (POJO) class. Is it possible to convert it (by jackson) to something like that: Wed, 23 Nov 2016 20:37:09 GMT ? I know that I may use some...

Show Detail

Converting java.sql.timestamp to millisecond format

I have a private java.sql.Timestamp myDate in some model (POJO) class like below private String isActive; private Date dob; private Timestamp createdDate; private Timestamp lastMktPrefUpdateAt; We...

Show Detail

No instance of play.api.libs.json.Format is available for scala.Option[java.sql.Timestamp] in the implicit scope

I am completely new to scala and play.api.libs.json.Format. Here is my code, I don't know where I am doing wrong. import java.sql.Timestamp import shapeless._ import slickless._ import play.api.libs.

Show Detail

Change the format of file path which is partitioned by java.sql.Timestamp

We are using spark as a data processing platform and Scala programming language. When we write data on storage account(ADLS gen 2), we partition the data by datetime column which is of type java.sql.

Show Detail

Format a java.sql.Timestamp into UTC format for a JSON object

I have a java.sql.Timestamp object which is already in the GMT timezone. When I print the Timestamp object, it shows like: 2016-11-28 10:49:27.0 I want to format it as: 2016-11-28T10:49:27.000Z I...

Show Detail

Converting NSString to proper JSON format

Converting NSString to proper JSON format.. NSString *input_json = [NSString stringWithFormat:@"{\"id\":\"%@\",\"seconds\":\"%d\",\"buttons\": \"%@\"}", reco_id, interactionTim

Show Detail

How to validate a java.sql.timestamp in JSF if format is different form the java.sql.timestamp in view

In my application there is an inputfield where the user should enter a timestamp like (yyy-mm-dd-hh.mm.ss.SSSSSS). In the database (DB2) the field is a timestamp (yyy-mm-dd hh.mm:ss:SSSSSS). Till n...

Show Detail

Generic way to convert a given String date in any format to java.sql.Timestamp

I want to convert a string representation of date in any format to java.sql.Timestamp,(format is also provided) we have tried using Timestamp.valueOf() and Date.valueOf() but both these method req...

Show Detail

Jackson change timestamp format

I'm outputting some database results via json webservice. Simple as: @GetMapping(produces = "application/json") public List<Map<String, Object>> get(Param params) { return jdbcTemp...

Show Detail

Strange behaviour when manually converting java.sql.Timestamp to LocalDate

I built a small function to convert a TimeStamp into a LocalDate, and stumbled upon strange behaviour. Here is the code: import java.sql.Timestamp; import java.time.Instant; import java.time.Local...

Show Detail