- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
BirthDatabase
Oracle 11g 中的表有以下五列:
ID
- 非空 - 号码 Name
- Varchar2(32) DOB
- 日期 Place
- Varchar2(32) BirthTime
- 时间戳(6) BirthTime
列不知道时区,但具有日期时间数据,位于
UTC
.
Europe\London
.
BirthTime
数据不是
timezone
意识到并且与系统 TZ 相比处于不同的 TZ 中。
BirthTime
在伦敦本地时间(即,当 DST 关闭时为 UTC,而当 DST 为 ON 时为 UTC+1)
cast
SQL 中的函数,但没有完全达到所需的输出
select
ID, Name, DOB, Place,
BirthTime as orig_BT,
cast(BirthTime as timestamp with time zone) as BT_withTz,
cast(cast(BirthTime as timestamp with time zone) at time zone 'Europe/London' as timestamp) BT_BST,
cast(cast(BirthTime as timestamp with time zone) at time zone 'UTC' as timestamp) BT_UTC
from
BirthDatabase
ID NAME DOB PLACE ORIG_BT BT_WITHTZ BT_BST BT_UTC
________________________________________________________________________________________________________________________________________________________________________
1 John 28-OCT-16 Bristol 28-OCT-16 10.48.12.000000000 28-OCT-16 10.48.12.000000000 EUROPE/LONDON 28-OCT-16 10.48.12.000000000 28-OCT-16 09.48.12.000000000
2 Jane 01-NOV-16 London 01-NOV-16 11.48.29.000000000 01-NOV-16 11.48.29.000000000 EUROPE/LONDON 01-NOV-16 11.48.29.000000000 01-NOV-16 11.48.29.000000000
ID NAME DOB PLACE ORIG_BT BT_DESIRED
____________________________________________________________________________________________
1 John 28-OCT-16 Bristol 28-OCT-16 10.48.12.000000000 28-OCT-16 11.48.12.000000000
2 Jane 01-NOV-16 London 01-NOV-16 11.48.29.000000000 01-NOV-16 11.48.29.000000000
BT_DESRIED = ORIG_BT + (BT_BST - BT_UTC)
BT_DESRIED = ORIG_BT + (BT_BST - BT_UTC)
表达式的语法是什么? 最佳答案
您可以使用以下查询:
select
ID, Name, DOB, Place, BirthTime as orig_BT,
FROM_TZ(BirthTime, 'UTC') AT TIME ZONE 'Europe/London' AS BT_BST
FROM BirthDatabase;
cast(BirthTime as timestamp with time zone)
Oracle 需要您的
SESSIONTIMEZONE
用于转换 - 不是数据库系统时区。
cast(BirthTime as timestamp with time zone) at time zone 'Europe/London'
执行
alter session set time_zone = 'UTC';
时会给出正确的结果预先。
关于当系统处于 TimeZone C 时,SQL 将 TimeStamp 列的 TimeZone 从 A 转换为 B,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40439250/
标题基本上说明了一切。 我主要对更新案例感兴趣。假设我们正在尝试更新具有时间戳记字段的记录,并且我们希望将该字段设置为记录更新的时间戳记。有没有办法做到这一点? 最佳答案 经过一些实验,我找到了合适的
我正在学习一门类(class),其中我必须将日期转换为 unix 时间戳。 import pandas as pd df = pd.read_csv('file.csv') print type(df
我在两个不同的数据库中运行了相同的语句:我的本地数据库和 Oracle Live SQL . CREATE TABLE test( timestamp TIMESTAMP DEFAULT SY
我在两个不同的数据库中运行了相同的语句:我的本地数据库和 Oracle Live SQL . CREATE TABLE test( timestamp TIMESTAMP DEFAULT SY
bson.timestamp.Timestamp需要两个参数:time 和 inc。 time 显然是存储在 Timestamp 中的时间值。 什么是公司?它被描述为递增计数器,但它有什么用途呢?它应
2016-08-18 04:52:14 是我从数据库中获取的时间戳,用于跟踪我想从哪里加载更多记录,这些记录小于该时间 这是代码 foreach($explode as $stat){
我想将 erlang:timestamp() 的结果转换为正常的日期类型,公历类型。 普通日期类型表示“日-月-年,时:分:秒”。 ExampleTime = erlang:timeStamp(),
我想将 erlang:timestamp() 的结果转换为正常的日期类型,公历类型。 普通日期类型表示“日-月-年,时:分:秒”。 ExampleTime = erlang:timeStamp(),
我是 Java 新手。我正在使用两个 Timestamp 对象 dateFrom和dateTo 。我想检查是否dateFrom比 dateTo早 45 天。我用这个代码片段来比较这个 if(dateF
在将 panda 对象转换为时间戳时,我遇到了这个奇怪的问题。 Train['date'] 值类似于 01/05/2014,我正在尝试将其转换为 linuxtimestamp。 我的代码: Train
我正在努力让我的代码运行。时间戳似乎有问题。您对我如何更改代码有什么建议吗?我看到之前有人问过这个问题,但没能成功。 这是我在运行代码时遇到的错误:'Timestamp' object has no
我正在尝试运行以下查询: SELECT startDate FROM tests WHERE startDate BETWEEN TIMESTAMP '1555248497'
我正在使用 Athena 查询以 bigInt 格式存储的日期。我想将其转换为友好的时间戳。 我试过了: from_unixtime(timestamp DIV 1000) AS readab
最近进行了一些数据库更改,并且 hibernate 映射出现了一些困惑。 hibernate 映射: ...other fields 成员模型对象: public class Mem
rng = pd.date_range('2016-02-07', periods=7, freq='D') print(rng[0].day) print(rng[0].month) 7 2 我想要
rng = pd.date_range('2016-02-07', periods=7, freq='D') print(rng[0].day) print(rng[0].month) 7 2 我想要
我必须在我的数据库中保存 ServerValue.TIMESTAMP 但它必须是一个字符串。当我键入 String.valueOf(ServerValue.TIMESTAMP); 或 ServerVa
在我的程序中,每个表都有一列 last_modified: last_modified int8 DEFAULT (date_part('epoch'::text, now()::timestamp)
我想将此时间戳对象转换为日期时间此对象是在数据帧上使用 asfreq 后获得的这是最后一个索引 Timestamp('2018-12-01 00:00:00', freq='MS') 想要的输出 2
我有一个包含时间序列传感器数据的大表。大型是指分布在被监控的各个 channel 中的从几千到 10M 的记录。对于某种传感器类型,我需要计算当前读数和上一个读数之间的时间间隔,即找到当前读数之前的最
我是一名优秀的程序员,十分优秀!