【问题标题】:Crystal reports converting a date into number水晶报表将日期转换为数字
【发布时间】:2017-09-18 10:53:09
【问题描述】:

我正在尝试获取员工每月的工作日。我正在尝试将起始日期和日期转换为仅包含日期值的数值。我知道公式 tonumber(totext(currentdate,'dd')) 但是它没有打印请求的输出。

【问题讨论】:

    标签: crystal-reports


    【解决方案1】:

    它应该可以正常工作,如下所示:

    【讨论】:

    • 很抱歉,似乎有误会,我需要计算员工本月工作的天数,而不是当天
    • @michelassi - 很抱歉造成误解。你能告诉我你的sql查询吗?
    • 抱歉迟到的回复工作太疯狂了这里是我的sql quary:local NumberVar i;周数 := (截断 ({Command.toDate} - dayofWeek({Command.toDate}) + 1 - ({Command.fromDate} - dayofWeek ({Command.fromDate}) + 1)) /7 ) * 5;天数 := DayOfWeek({Command.toDate}) - DayOfWeek({Command.fromDate}) + 1 + (if DayOfWeek({Command.fromDate}) = crSunday 然后 -1 else 0) + (if DayOfWeek({Command.toDate }) = crSaturday 然后 -1 否则 0);
    • //for iYear := Year({HEM1.fromDate}) to Year({HEM1.toDate}) do ( // Local DateVar Array Holidays := getHolidays(iYear); //for i := 1 to uBound(Holidays) do ( // local NumberVar hMonth := Month(Holidays[i]); // local NumberVar hDay := Day(Holidays[i]); //local DateVar hDate := cDate(iYear , hMonth, hDay); //if DayOfWeek(hDate) in crMonday to crFriday and // hDate in {HEM1.fromDate} to {HEM1.toDate} then Hol := Hol+1;
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-07-28
    • 1970-01-01
    • 1970-01-01
    • 2013-01-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多