- 论坛徽章:
- 0
|
(QDAYOFWEEK) 系统值好象只能返回当前日期的星期吧? 如果欲知道指定日期的星期又该如何?
我这里看到一段源码, 可惜现在使用中的机器版本太低了,自由格式和%date函数都不认,无法测试,但基本思想也就是楼上有人说的除7加1.
- **********************************************************************
- * Procedure - #dayOfYear *
- * Description - Receive an *ISO date field and return the number *
- * of the day in the year. *
- * Input - *ISO date field *
- * Output - Number 1 - 366 *
- **********************************************************************
- p #dayOfYear b export
- d #dayOfYear pi 3 0
- d inputDate d value options( *nopass )
- d ds
- d workDate d datfmt( *jul )
- d day 3s 0 overlay( workDate : 4 )
- /free
- if %parms = 0;
- workDate = %date();
- else;
- workDate = inputDate;
- endif;
- return day;
- /end-free
- p #dayOfYear e
- /eject
- **********************************************************************
- * Procedure - #weekOfYear *
- * Description - Receive an *ISO date field and return the number *
- * of the week of the year. *
- * Input - *ISO date field *
- * Output - Number 1 - 52. *
- **********************************************************************
- p #weekOfYear b export
- d #weekOfYear pi 2 0
- d inputDate d value options( *nopass )
- d workDate s d
- /free
- if %parms = 0;
- workDate = %date();
- else;
- workDate = inputDate;
- endif;
- return %div( #dayOfYear( workDate ) : 7 ) + 1;
- /end-free
- p #weekOfYear e
复制代码
[ 本帖最后由 blogliou 于 2006-6-16 15:04 编辑 ] |
|