How to convert “1985-02-07T00:00:00.000Z” (ISO8601) to a date value in Oracle?

to_date converts the input to a DATE type which does not support fractional seconds. To use fractional seconds you need to use a TIMESTAMP type which is created when using to_timestamp pst’s comment about the ff3 modifier is also correct. “Constant” values in the format mask need to be enclosed in double quote So the … Read more

How do I get a Unix Timestamp in Clojure?

Pretty much all JVM-based timestamp mechanisms measure time as milliseconds since the epoch – so no, nothing standard** that will give seconds since epoch. Your function can be slightly simplified as: (quot (System/currentTimeMillis) 1000) ** Joda might have something like this, but pulling in a third-party library for this seems like overkill.

Python: reduce precision pandas timestamp dataframe

You could convert the underlying datetime64[ns] values to datetime64[s] values using astype: In [11]: df[‘Time’] = df[‘Time’].astype(‘datetime64[s]’) In [12]: df Out[12]: Record_ID Time 0 94704 2014-03-10 07:19:19 1 94705 2014-03-10 07:21:44 2 94706 2014-03-10 07:21:45 3 94707 2014-03-10 07:21:54 4 94708 2014-03-10 07:21:55 Note that since Pandas Series and DataFrames store all datetime values as … Read more

Automatically populate a timestamp field in PostgreSQL when a new row is inserted

To populate the column during insert, use a DEFAULT value: CREATE TABLE users ( id serial not null, firstname varchar(100), middlename varchar(100), lastname varchar(100), email varchar(200), timestamp timestamp default current_timestamp ) Note that the value for that column can explicitly be overwritten by supplying a value in the INSERT statement. If you want to prevent … Read more

Resetting the time part of a timestamp in Java

You can go Date->Calendar->set->Date: Date date = new Date(); // timestamp now Calendar cal = Calendar.getInstance(); // get calendar instance cal.setTime(date); // set cal to date cal.set(Calendar.HOUR_OF_DAY, 0); // set hour to midnight cal.set(Calendar.MINUTE, 0); // set minute in hour cal.set(Calendar.SECOND, 0); // set second in minute cal.set(Calendar.MILLISECOND, 0); // set millis in second Date … Read more

How do I deserialize timestamps that are in seconds with Jackson?

I wrote a custom deserializer to handle timestamps in seconds (Groovy syntax). class UnixTimestampDeserializer extends JsonDeserializer<DateTime> { Logger logger = LoggerFactory.getLogger(UnixTimestampDeserializer.class) @Override DateTime deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, JsonProcessingException { String timestamp = jp.getText().trim() try { return new DateTime(Long.valueOf(timestamp + ‘000’)) } catch (NumberFormatException e) { logger.warn(‘Unable to deserialize timestamp: ‘ + timestamp, e) … Read more