timestamp

Oracle: how to add minutes to a timestamp?

99封情书 提交于 2019-12-28 01:59:11
问题 I need to add 30 minutes to values in a Oracle date column. I do this in my SELECT statement by specifying to_char(date_and_time + (.000694 * 31) which works fine most of the time. But not when the time is on the AM/PM border. For example, adding 30 minutes to 12:30 [which is PM] returns 1:00 which is AM. The answer I expect is 13:00 . What's the correct way to do this? 回答1: All of the other answers are basically right but I don't think anyone's directly answered your original question.

How to convert integer timestamp to Python datetime

落爺英雄遲暮 提交于 2019-12-27 10:59:24
问题 I have a data file containing timestamps like "1331856000000". Unfortunately, I don't have a lot of documentation for the format, so I'm not sure how the timestamp is formatted. I've tried Python's standard datetime.fromordinal() and datetime.fromtimestamp() and a few others, but nothing matches. I'm pretty sure that particular number corresponds to the current date (e.g. 2012-3-16), but not much more. How do I convert this number to a datetime ? 回答1: datetime.datetime.fromtimestamp() is

PHP timestamp convert to javascript?

故事扮演 提交于 2019-12-27 06:45:19
问题 Hello friends this my my php code. <?php $date3=date_default_timezone_set('Europe/Paris'); echo $abc3=date('Y-m-d h:i:s'); $t3= strtotime($abc3) * 1000; ?> print date is 2014-01-23 08:43:45 Friends This is my Javascript Code <script> var t3=<?php echo $t3; ?>; function update_clock3(){ var now = new Date(Number(t3)); var hours = now.getHours(); var minutes = now.getMinutes(); var seconds = now.getSeconds(); alert(hours +":"+ minutes + ":" + seconds); } </script> The Javascript code is print

Warning when trying to convert timestamp to readable format foreach instance while looping thorugh an array

心不动则不痛 提交于 2019-12-25 14:41:24
问题 Warning when trying to convert timestamp to readable format foreach instance while looping through an array. <?php $json_feed = "http://localhost/sample/json/blog.json"; $json = file_get_contents($json_feed); $obj = json_decode($json, true); $dateCreated = $array['post'].dateCreated; $date = date('m/d/Y H:i:s', $dateCreated); foreach($obj['post'] as $article_array){ $url = $article_array['url']; $title = $article_array['title']; $category = $article_array['category']; $large_summary =

Converting Date Timestamp to EPOCH via XSL

旧时模样 提交于 2019-12-25 09:47:55
问题 Apologies in advanced for the large block of code. I am able to output a timestamp with the code below. I would now like it to output in an EPOCH format. I cant seem to get anything to work looking at other submitted tickets. I am admittedly a bit of noob to XSL. I am confined to XSL1 Any help is appreciated. Thank you in advanced. <?xml version="1.0" encoding="utf-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:ms="urn:schemas-microsoft-com:xslt"

Spark SQL: parse timestamp without seconds

我的未来我决定 提交于 2019-12-25 09:43:11
问题 Some data I don't own comes with a field that's supposed to be a timestamp , but sometimes doesn't seem to comply with the ISO 8601 standard. In my code, I defined a schema and then when Spark SQL parses my json data, I get the following error: java.lang.IllegalArgumentException: 2016-10-07T11:15Z The source data has the following: "transaction_date_time": "2016-10-07T11:15Z" And my schema is defined as such: val schema = (new StructType) .add("transaction_date_time", TimestampType) I believe

WSO2 DSS issue when selecting Timestamps from Database

久未见 提交于 2019-12-25 09:28:39
问题 I've an issue defining a query to get some data out of Cassandra in WSO2 DSS. The query (and the operation) itself is working but my problem is when I try to get a timestamp as a result. I only get the date and the timezone (2017-01-11+0100) the time part is missing. I guess that this is somehow related on the mapping to dateTime xsdType that is not working correctly. Did you already face this issue, and do you have a solution to get the timestamp? Here is a query sample <query id=

How to check if a timestamp is an hour old?

爱⌒轻易说出口 提交于 2019-12-25 08:54:01
问题 I am building a caching system to store Twitter API tweets as to avoid violating the hourly call limit. I am storing the tweets in a database with a timestamp and then checking in PHP to see if the timestamp is an hour old, if so then I call the API again. At the moment I can't seem to get it working. Here is what I curently have (which I admit is most probably wrong!) if($results->tweet_date <= strtotime('-1 hours')) { //do api call } else { //call tweets from database } This doesn't seem to

Specifying default value for a field for table creation in postgresql

拜拜、爱过 提交于 2019-12-25 07:58:20
问题 Following is my table design: CREATE TABLE "x"."y"( "z" timestamp NOT NULL, "a" Timestamp NOT NULL DEFAULT z + 18 months, ) WITH (OIDS=FALSE) ; How do I specify the default value of 'a'? Can I specify this at the time of the table creation? 回答1: As postgresql documentation states The DEFAULT clause assigns a default data value for the column whose column definition it appears within. The value is any variable-free expression ( subqueries and cross-references to other columns in the current

Specifying default value for a field for table creation in postgresql

▼魔方 西西 提交于 2019-12-25 07:56:02
问题 Following is my table design: CREATE TABLE "x"."y"( "z" timestamp NOT NULL, "a" Timestamp NOT NULL DEFAULT z + 18 months, ) WITH (OIDS=FALSE) ; How do I specify the default value of 'a'? Can I specify this at the time of the table creation? 回答1: As postgresql documentation states The DEFAULT clause assigns a default data value for the column whose column definition it appears within. The value is any variable-free expression ( subqueries and cross-references to other columns in the current