Excel日期格式到DB2 SQL中的时间戳(Excel Date Format To Timestamp in DB2 SQL)
我有一个Excel提取,它将日期加载到一个不是一致格式的表中,这使得在将它们复制到另一个表时转换为时间戳更具挑战性。
示例日期是:
- 2015年5月1日
- 2015年5月15日
- 2015年12月1日
- 2015年12月15日
我需要将其转换为时间戳格式。 首先,我只是试图将日期解析并连接成一个格式化为时间戳的字符类型。
时间戳格式必须为:
YYYY-MM-DD HH24:MM:SS
我们的DB2实例非常旧,不接受以下函数:
INSTR
,LOCATE_IN_STRING
但是,它确实接受:
LOCATE
我让代码适用于4种日期格式中的2种,因为我在参数中指定了实际数字,而不是使用可以处理不同日期格式的函数。 修改查询后,在显示不佳的表中,我的结果是:
旧日期 - 新日期
2015年4月3日 - 2015-04-3 / 00:00:00
2015年3月30日 - 2015-03-30 00:00:00
2015年12月31日 - 2015-01- / 3 00:00:00
2015年12月3日 - 2015-01- / 3 00:00:00
上表中的“ - ”表示表中的不同列。
我目前的代码是:
SELECT STARTDATE , RIGHT(LTRIM(RTRIM(STARTDATE)), 4) --YEAR || '-' || RIGHT('00' || SUBSTR(STARTDATE, 1, LOCATE(STARTDATE, '/', 1)+1), 2) --MONTH || '-' || LEFT(SUBSTR(STARTDATE, 3, LOCATE(STARTDATE, '/', 1)+2) || '00', 2) --DAY || ' 00:00:00' AS STARTDATE FROM SCHEMA1.TABLE1
有人可以帮忙吗?
有关DB2版本的信息:
- DB2 / NT SQL08016
- 用于JDBC和SQLJ 4.13.127的IBM数据服务器驱动程序
I have an Excel extract that is loading dates into a table that are not a consistent format, making it more challenging to convert to a timestamp when we copy it into another table.
Example dates are:
- 5/1/2015
- 5/15/2015
- 12/1/2015
- 12/15/2015
I need to convert this to a timestamp format. To start, I am just trying to parse and concatenate the date into a character type formatted like a timestamp.
The timestamp format needs to be:
YYYY-MM-DD HH24:MM:SS
Our DB2 instance is very old and does not accept the following functions:
INSTR
,LOCATE_IN_STRING
However, it does accept:
LOCATE
I had the code working for 2 of the 4 date formats because I specified actual numbers in the parameters instead of using functions that could handle the different date formats. After modifying the query, in a poorly displayed table, my results are:
OLD DATE -- NEW DATE
4/3/2015 -- 2015-04-3/ 00:00:00
3/30/2015 -- 2015-03-30 00:00:00
12/31/2015 -- 2015-01-/3 00:00:00
12/3/2015 -- 2015-01-/3 00:00:00
The "--" in my table above indicate different columns in the table.
My current code is:
SELECT STARTDATE , RIGHT(LTRIM(RTRIM(STARTDATE)), 4) --YEAR || '-' || RIGHT('00' || SUBSTR(STARTDATE, 1, LOCATE(STARTDATE, '/', 1)+1), 2) --MONTH || '-' || LEFT(SUBSTR(STARTDATE, 3, LOCATE(STARTDATE, '/', 1)+2) || '00', 2) --DAY || ' 00:00:00' AS STARTDATE FROM SCHEMA1.TABLE1
Can anyone help?
Information about our DB2 version:
- DB2/NT SQL08016
- IBM Data Server Driver for JDBC and SQLJ 4.13.127
原文:https://stackoverflow.com/questions/30244958
最满意答案
找到它,你需要获取你的元素,然后调用play()函数:
视频的html:
<video id="vid_1" poster="http://sandbox.thewikies.com/vfe-generator/images/big-buck-bunny_poster.jpg" width="640" height="360"> <source src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4" type="video/mp4" /> <source src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.webm" type="video/webm" /> <source src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.ogv" type="video/ogg" /> Your browser does not support HTML5 videos. </video>
然后获取视频元素并解雇播放:
//video play button $('.play_button').click(function(){ var video = $('video#vid_1').get(0); //get the native browser source if (video.paused) { video.play(); //if paused, play } else{ video.pause(); //if playing, pause } });
所以基本上你可以随时调用它......
Found it, you need to get your element, and then call the play() function :
The html for the video :
<video id="vid_1" poster="http://sandbox.thewikies.com/vfe-generator/images/big-buck-bunny_poster.jpg" width="640" height="360"> <source src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4" type="video/mp4" /> <source src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.webm" type="video/webm" /> <source src="http://clips.vorwaerts-gmbh.de/big_buck_bunny.ogv" type="video/ogg" /> Your browser does not support HTML5 videos. </video>
Then get the video element and fire the play :
//video play button $('.play_button').click(function(){ var video = $('video#vid_1').get(0); //get the native browser source if (video.paused) { video.play(); //if paused, play } else{ video.pause(); //if playing, pause } });
So basically you can call it whenever you want...
相关问答
更多-
HTML5视频暂停和倒带(HTML5 Video pause and rewind)[2023-08-06]
您可以在打开它(或关闭弹出窗口)时获取对jQuery视频元素的引用,并使用pause()暂停它,然后将“currentTime”属性设置为0以返回到开头。 以下是对currentTime 文档的参考。 这是一个代码示例: var mediaElement = document.getElementById("video"); mediaElement.pause(); mediaElement.currentTime = 0; You can get a reference to your jquer ... -
我不认为这在纯HTML5中是可行的 。 主要是因为当您在网页中看到“对象”时流没有加载,所以客户端无法获得所需的帧。 不过,最好的选择是在加载页面之前保存/缓存“随机帧” ,然后将其用作视频的海报。 这将允许您减少客户工作并节省带宽。 检查一下,这是我发现的第一件事(如果你使用PHP并且你想要一个' 快速和肮脏 '的方式来获取框架) 更新 显然这里有一个popcorn.js的解决方案,但似乎你不能以你需要的方式(我想)来做。 这是因为,由于浏览器安全问题,只能在同一个域内执行此操作。 I don't thi ...
-
Android上的HTML5 [2022-05-21]
我刚刚做了一些实验,从我可以告诉你需要三件事情: 调用视频时不能使用type属性。 您必须手动调用video.play() 视频必须编码为一些相当严格的参数; 通过“Web Optimized”按钮检查Handbrake上的iPhone设置是否正常。 看看这个页面上的演示: http : //broken-links.com/tests/video/ 在所有支持视频功能的桌面浏览器中,iPhone和Android都可以使用AFAIK。 这是标记:您必须等到浏览器知道视频的持续时间,才能寻找到特定的时间。 所以,我想你想等待'loadedmetadata'事件这样的事情: document.getElementById('vid1').addEventListener('loadedmetadata', function() { this.currentTime = 50; }, false); You have to wait until the browser knows the duration of the video before y ...加载后播放HTML5视频(Play HTML5 video after its loaded)[2024-01-01]
你为什么不使用HTML5视频属性? 没有必要使用JavaScript。找到它,你需要获取你的元素,然后调用play()函数: 视频的html:您可以读取视频元素的buffered属性以查看已加载的时间范围。 buffered属性是已加载的时间范围的集合; 你可以用buffered.start(n)和buffered.end(n)来读取第n 个范围的开始和结束。 由于您对第一个范围的结束时间感兴趣,因此您可以使用videoElm.buffered.end(0)读取某些视频videoElm上加载的秒数。元素触发progress事件以指示它已加载了一个新的数据块(因此buffered的某个时间范围的结束时间正在增加)。 您可以在每次pr ... 这应该工作: 使用带有autoplay属性的1个视频标签创建一个空的html页面 然后使用JavaScript创建一个包含您要播放的视频的所有路径的数组 将函数附加到视频标记的“已结束”事件 函数内部生成一个随机索引Math.floor(Math.random() * clipPaths.length); 使用生成的索引从数组中获取随机路径 将路径设置为视频标记的“src”属性 你只需要将所有路径放在clipPaths数组中......您的问题似乎是一般的HTML样式限制。 使用z-index时的一般规则是z-index文档树中位于同一级别的元素:因此在您的示例中,它将是z-indexing div[role="main"]和z-indexing您需要使用iFrame API ,否则由于跨域策略,您无法与视频交互: var player; function onYouTubeIframeAPIReady() { player = new YT.Player('player', { height: '390', width: '640', videoId: 'M7lc1UVf-VE', events: { 'onReady': onPlayerReady, 'onStateChange': ...相关文章
更多- 《DB2设计与性能优化-原理、方法与实践》扫描版[PDF]
- HTML5 Web SQL Database 数据库
- 锋利的SQL
- MyBatis 动态 SQL详解
- HADOOP NAMENODE FORMAT过程分析
- 用Hibernate映射mysql问题(Timestamp)
- Hadoop教程:NameNode的format操作做了什么
- sql问题
- 在java.util.Date中,如何比较两个Date的大小,精确到分
- Hadoop namenode -format“ get ”java.net.UnknownException
最新问答
更多- 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
- 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
- OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
- 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
- codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
- 在计算机拍照在哪里进入
- 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
- No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
- 单页应用程序:页面重新加载(Single Page Application: page reload)
- 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
- System.StackOverflow错误(System.StackOverflow error)
- KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
- 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
- android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
- TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
- 企业安全培训的各项内容
- 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
- C#类名中允许哪些字符?(What characters are allowed in C# class name?)
- NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
- 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
- 将多个行和可变行移动到列(moving multiple and variable rows to columns)
- 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
- 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
- Angular $资源不会改变方法(Angular $resource doesn't change method)
- 在Angular 5中不是一个函数(is not a function in Angular 5)
- 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
- 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
- 常见的python rpc和cli接口(Common python rpc and cli interface)
- Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
- 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)