首页 \ 问答 \ 如何从java中的命令提示符提示“打开文件窗口”?(how to prompt “open file window” from command prompt in java? [duplicate])

如何从java中的命令提示符提示“打开文件窗口”?(how to prompt “open file window” from command prompt in java? [duplicate])

这个问题在这里已有答案:

我试图从java中的命令提示符提示“打开文件窗口”,并计划将所选文件作为输入文件而不是

FileInputStream fis=new FileInputStream(args[0]);

但是还没有成功,请告诉我如何在java中的命令提示符下执行此操作。


This question already has an answer here:

I am trying to prompt "open file window" from command prompt in java and planning to take that selected file as input file instead of

FileInputStream fis=new FileInputStream(args[0]);

but not succeeded yet, please some tell me how to do it in command prompt in java.


原文:
更新时间:2022-06-13 19:06

最满意答案

如果您想在Oracle where子句中完全执行此操作,您可以执行以下操作:

WHERE CHRGDTTM >= ADD_MONTHS(TRUNC(sysdate, 'MM'), -1)
AND CHRGDTTM < TRUNC(sysdate, 'MM')

TRUNC(date)函数截断了提供的日期 - 在这种情况下是系统日期; 默认情况下它会删除时间部分,因此会在今天早上给你午夜,但这会修改MM格式模型的行为,并在当月的第一个月提供午夜。 所以今天TRUNC(SYSDATE, 'MM')为您提供2016-01-26 00:00:00。 您可以将其用作日期范围的上端。

ADD_MONTHS()函数 ,添加了几个月,-1这里给你2015-12-01 00:00:00。 放在一起,为您提供2015-12-01 00:00:00之前的所有内容,但不包括2016-01-01 00:00:00,这相当于您的BETWEEN范围。

您还可以使用间隔计算来获取上个月的开头:

WHERE CHRGDTTM >= TRUNC(sysdate, 'MM') - INTERVAL '1' MONTH
AND CHRGDTTM < TRUNC(sysdate, 'MM')

具有相同的效果,并且是安全的,因为你总是会得到计算中的有效日期; 几个月末的日期可能更成问题。

您可以在文档中阅读有关日期时间/间隔算法的更多信息。


If you want to do this entirely within the Oracle where clause you can do:

WHERE CHRGDTTM >= ADD_MONTHS(TRUNC(sysdate, 'MM'), -1)
AND CHRGDTTM < TRUNC(sysdate, 'MM')

The TRUNC(date) function truncates the supplied date - the system date in this case; by default it removes the time part so gives you midnight this morning, but this modified that behaviour with the MM format model, and gives you midnight on the first of the current month. So today TRUNC(SYSDATE, 'MM') gives you 2016-01-26 00:00:00. You can use that as it is for the upper end of your date range.

The ADD_MONTHS() function, well, adds a number of months, -1 here to give you 2015-12-01 00:00:00 instead. Put together that gives you everything from 2015-12-01 00:00:00 up to, but no including, 2016-01-01 00:00:00, which is equivalent to your BETWEEN range.

You could also use an interval calculation to get the start of the previous month:

WHERE CHRGDTTM >= TRUNC(sysdate, 'MM') - INTERVAL '1' MONTH
AND CHRGDTTM < TRUNC(sysdate, 'MM')

which has the same effect, and is safe as you're always going to end up with a valid date from the calculation; dates at the ends of months can be more problematic.

You can read more about datetime/interval arithmetic in the documentation.

相关问答

更多

相关文章

更多

最新问答

更多
  • 您如何使用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)