如何从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:
- How to “Open” and “Save” using java 6 answers
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.
原文:
最满意答案
如果您想在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 theMM
format model, and gives you midnight on the first of the current month. So todayTRUNC(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.
相关问答
更多-
3个选项,给出问题陈述: 您想编写自己的表达式来选择表吗? TABLE_QUERY() https://cloud.google.com/bigquery/query-reference#table-query 但是,由于您使用按天划分的表来执行此操作,因此TABLE_DATE_RANGE()的灵活性较低,但效率更高: https://cloud.google.com/bigquery/query-reference#table-date-range 正如Elliott所说,分区表是使用一个巨型表的新推荐方 ...
-
不知道你需要什么Expression ,我不能确定这将做你需要的一切。 使用AsQueryable让我怀疑你没有(如果你直接查询提供者,你应该已经是IQueryable
); 但是,你必须确认。 但是,如果您不需要使用Expression ,您可以执行以下操作: Func locClause = (l => l.id == locId); var result = from l in UnitOfWork.Localization.AsQ ... -
你可以将“!String.IsNullOrWhiteSpace(baz)”替换为“!(baz == null || baz.Trim()== string.Empty)”,它应该可以工作。 You can replace "!String.IsNullOrWhiteSpace(baz)" with "!(baz == null || baz.Trim() == string.Empty)" and it should work.
-
您可以使用OR(并将您的条件分组) SELECT date(datetime) as dateonly , sum(CASE message when 'Accepted Images' then 1 else 0 end) as AcceptedIMG, sum(CASE message when 'Rejected Images' then 1 else 0 end) as RejectedIMG, sum(CASE when message like '%Changed to %' the ...
-
您的Offset包括LT , LT包含Min聚合表达式。 聚合表达式不能在WHERE子句中使用,只能在HAVING子句中使用。 请尝试以下方法: SELECT po.Item, ist.SKU, po.[EX-FACTORY DATE], Min(lt.Intransit_LT) AS LT, DateAdd('d',[LT],po.[EX-FACTORY DATE]) AS Offset FROM (tbl_Item_PO AS po LEFT JOIN tbl_ ...
-
如何在带有连接的EF Where()子句中使用表达式树?(How can I use a Expression tree in an EF Where() clause with join?)[2023-06-25]
我通过这个改变解决了我的问题,这对我有用: private object bindingSourceTbl1_DataSourceBinding(object sender, EventArgs e) { using (SampleDbEntities dbo = new SampleDbEntities()) { return dbo.Tbl1.Join(dbo.Tbl2, x => x.Id, y => y.Tbl1Id, (x, y) => new { Tbl1 = x ... -
hql.concat(" like lower('%:critere%') ") 应该重写为: hql.concat(" like :critere ") query = query.setParameter("critere", "%" + search.toLowerCase(Locale. ....) + "%"); hql.concat(" like lower('%:critere%') ") should be rewrittent to : hql.concat(" like :crit ...
-
我会怀疑SET_END_TIME和SET_START_TIME中的值以及导致错误的计算。 你能输出每一列,看看SET_START_TIME在某些时候是否为负值并产生你得到的错误? Turns out the root cause was invalid values in the columns I was using for the arithmetic in my where clause, and the solution was to use a case expression inside a s ...
-
首先,如果propertyAccess是字符串属性的访问者,则如下所示 var sel = Expression.Lambda
>(propertyAccess, parameter); 应该 var sel = Expression.Lambda >(propertyAccess, parameter); 其次, Compile在EF表达式中不起作用。 您可以使用Expression类的方法手动构建整个谓词表达式,但这相对 ... -
如果您想在Oracle where子句中完全执行此操作,您可以执行以下操作: WHERE CHRGDTTM >= ADD_MONTHS(TRUNC(sysdate, 'MM'), -1) AND CHRGDTTM < TRUNC(sysdate, 'MM') TRUNC(date)函数截断了提供的日期 - 在这种情况下是系统日期; 默认情况下它会删除时间部分,因此会在今天早上给你午夜,但这会修改MM格式模型的行为,并在当月的第一个月提供午夜。 所以今天TRUNC(SYSDATE, 'MM')为您提供201 ...