date-arithmetic

Excel date/time calculation

喜夏-厌秋 提交于 2019-12-13 01:53:00
问题 I'm trying to calculate the difference between two times that are given in this format: Fri 07/02/2014 10:16 with the cell using a custom format ddd dd/mm/yyyy hh:mm and display the result in hours. I have two dates/times: A1 B1 Fri 07/02/2014 10:00 Fri 07/02/2014 10:42 The formula I have in C1 is =TEXT(TIME(LEFT(RIGHT(B1,5),2),RIGHT(RIGHT(B1,5),2),0)-TIME(LEFT(RIGHT(A1,5),2),RIGHT(RIGHT(A1,5),2),0),"h") Which gives me the answer 4, which I thought should be something like 0.68 Can anyone

Looking for definitive ISO week calculator in Visual Basic (in Visual Studio Express 2010)

╄→尐↘猪︶ㄣ 提交于 2019-12-12 19:29:56
问题 I'm looking for a definitive, standard (i.e. certified as being correct or tested reasonably thoroughly) for calculating the ISO week from a date, in Visual Basic (i.e. to run in a Visual Studio Express 2010 Visual Basic project) (Unsuccessful) Research so far : I found some routines that were Visual Basic for Applications oriented; reliant on Excel environment, some things not present in Visual Studio Express 2010 Visual Basic: http://www.xtremevbtalk.com/showthread.php?t=180642 http://www

Properly handle TIME WITH TIME ZONE in PostgreSQL

梦想的初衷 提交于 2019-12-12 16:28:55
问题 We have a table that is filled with data from a legacy report of another system. The columns of that table reflect the same structure of the report. Here are a abbreviated structure of the table: CREATE TABLE IF NOT EXISTS LEGACY_TABLE ( REPORT_DATE DATE NOT NULL, EVENT_ID BIGINT PRIMARY KEY NOT NULL, START_HOUR TIMESTAMP WITHOUT TIME ZONE, END_HOUR TIME WITHOUT TIME ZONE, EXPECTED_HOUR TIME WITHOUT TIME ZONE ); We are refactoring this table to deal with different time zones of different

Oracle Time Comparisons

 ̄綄美尐妖づ 提交于 2019-12-12 16:19:04
问题 Is Oracle (10g) doing a proper TIME comparison here, or do I need to convert to decimal time and then compare? E.g., IF (SELECT TO_CHAR(sysdate,'HH24:MI:SS') from dual) <= '15:00' THEN (...) Thanks. 回答1: IF (sysdate <= trunc(sysdate)+15/24) THEN (...) should do the trick... 回答2: You can't do a select in an if statement, but you can do a direct comparison to sysdate. If you're doing it like this it would probably be better to use a number rather than relying on implicit conversion. You also

Selecting employees with birthdays in given range using Oracle SQL

你说的曾经没有我的故事 提交于 2019-12-12 12:37:56
问题 For selecting birthdays between two months where FROMDATE and TODATE are some parameters in a prepared statement I figured something like this: select p.id as person_id, ... ... where e.active = 1 and extract(month from TODATE) >= extract(month from e.dateOfBirth) and extract(month from e.dateOfBirth) >= extract(month from FROMDATE) order by extract(month from e.dateOfBirth) DESC, extract(day from e.dateOfBirth) DESC How can this be improved to work with days as well? 回答1: There's more than

Using DateDiff() in Oracle

╄→尐↘猪︶ㄣ 提交于 2019-12-12 02:34:48
问题 Please consider the following query. I've realised that using fans.checkout-fans.checkin to calculate the difference between two dates (in days) is not a very good idea. How can I rewrite it so that I can use DateDiff() instead? I can't seem to simply replace fans.checkout-fans.checkin with this function. select x.name from ( select fans.name, dense_rank() over (order by fans.checkout-fans.checkin desc) as rnk from fans where fans.checkout-fans.checkin is not null ) x where x.rnk = 1 回答1: Why

How to pass a parameter into a date function

我是研究僧i 提交于 2019-12-12 01:25:02
问题 I am trying to create a simple function and I cannot seem to pass in a parameter into the date function. Here is the function: CREATE OR REPLACE FUNCTION test(source int,days text) RETURNS integer AS $totals$ declare totals integer; BEGIN select count(id) into totals from ad where createdate::date = date(current_date - interval '$2' day) and source = $1; RETURN totals; END; $totals$ LANGUAGE plpgsql; 回答1: @IMSoP already shed light upon your syntax error. However, this can be simpler, faster

How to use SIFT algorithm with a color inverted image

佐手、 提交于 2019-12-11 16:49:30
问题 For example I have two images, where first one is a regular and second one with a color inversion (I mean 255 - pixel color value). I've applied SIFT algorithm to both of them using OpenCV and Lowe paper, so now I have key points and descriptors of each image. KeyPoints positions do match, but KeyPoints orientations and Descriptors values do not, because of color inversion. I'm curious do anybody try to solve such a problem? In addition here are the gradients example: I'm using OpenCV C++

Convert LDAP Date in SQL (milliseconds to nanoseconds)

时光怂恿深爱的人放手 提交于 2019-12-11 11:43:36
问题 I am getting date in milliseconds format. i.e.: 1427342400000 is essentially 3/26/2015 . Now I want to further convert date in nanoseconds and pass this value in accountexpires attribute in Active Directory. What is the query to convert milliseconds date to nanoseconds date? Any help would be greatly appreciated. 回答1: Now I want to further convert date in nanoseconds Ok, but convert to nano seconds since when? Looking at your example, I assume the start point to be '01-JAN-1970' . If I want

How to aggregate data from multiple years on MM-DD, ignoring year

别来无恙 提交于 2019-12-11 08:26:49
问题 Postgres version 9.4.18, PostGIS Version 2.2. Here are the tables I'm working with (and can unlikely make significant changes to the table structure): Table ltg_data (spans 1988 to 2018): Column | Type | Modifiers ----------+--------------------------+----------- intensity | integer | not null time | timestamp with time zone | not null lon | numeric(9,6) | not null lat | numeric(8,6) | not null ltg_geom | geometry(Point,4269) | Indexes: "ltg_data2_ltg_geom_idx" gist (ltg_geom) "ltg_data2_time