搜索
查看: 2079|回复: 9

有没有返回当前星期几的函数?

[复制链接]
发表于 2006-12-19 20:20:57 | 显示全部楼层 |阅读模式 来自 北京海淀
有没有返回当前星期几的函数?
发表于 2006-12-19 21:01:41 | 显示全部楼层 来自 北京海淀

回复: 有没有返回当前星期几的函数?

public Week(year, month, day)
{
if(month==1 || month==2)
{
year--
month+=12
}
return (day+2*month+3*(month+1)/5+year+year/4-year/100+year/400)%7
}
return 0-6 stand for Monday-Sunday
回复

使用道具 举报

 楼主| 发表于 2006-12-19 21:08:10 | 显示全部楼层 来自 北京海淀

回复: 有没有返回当前星期几的函数?

晕,我的意思是从系统返回当前的星期。就象get_time一样,不过get_time好像只能返回日期和时间,不能返回星期。
回复

使用道具 举报

发表于 2006-12-19 21:11:32 | 显示全部楼层 来自 北京海淀

回复: 有没有返回当前星期几的函数?

什么叫做返回当前的星期?是 当天是星期几 还是 这个星期是当年的第几个星期?
回复

使用道具 举报

 楼主| 发表于 2006-12-19 21:42:39 | 显示全部楼层 来自 北京海淀

回复: 有没有返回当前星期几的函数?

我的意思是:返回今天是星期几。
回复

使用道具 举报

发表于 2006-12-19 21:59:23 | 显示全部楼层 来自 北京海淀

回复: 有没有返回当前星期几的函数?

给你的不就是吗,把年、月、日输进去,返回值就是 今天是星期几

例子: new week = Week(2006, 12, 19)
回复

使用道具 举报

发表于 2006-12-19 22:01:21 | 显示全部楼层 来自 北京海淀

回复: 有没有返回当前星期几的函数?

刚才不小心把我的源码文件夹删了,惊出一身冷汗。。。 里面有我编的一堆插件,幸亏用了磁盘恢复。否则玩儿玩了。
回复

使用道具 举报

发表于 2006-12-19 22:19:00 | 显示全部楼层 来自 北京海淀

回复: 有没有返回当前星期几的函数?

%a abbreviated weekday name (Sun)
%A full weekday name (Sunday)
%b abbreviated month name (Dec)
%B full month name (December)
%c date and time (Dec 2 06:55:15 1979)
%d day of the month (02)
%H hour of the 24-hour day (06)
%I hour of the 12-hour day (06)
%j day of the year, from 001 (335)
%m month of the year, from 01 (12)
%M minutes after the hour (55)
%p AM/PM indicator (AM)
%S seconds after the minute (15)
%U Sunday week of the year, from 00 (48)
%w day of the week, from 0 for Sunday (6)
%W Monday week of the year, from 00 (47)
%x date (Dec 2 1979)
%X time (06:55:15)
%y year of the century, from 00 (79)
%Y year (1979)

这是 get_time 格式表,返回值好像是英文
回复

使用道具 举报

 楼主| 发表于 2006-12-19 23:32:37 | 显示全部楼层 来自 北京海淀

回复: 有没有返回当前星期几的函数?

Post by jim_yang
刚才不小心把我的源码文件夹删了,惊出一身冷汗。。。 里面有我编的一堆插件,幸亏用了磁盘恢复。否则玩儿玩了。


汗。 还是压缩保存一份在网上吧。 否则哪天失手。哭吧
回复

使用道具 举报

 楼主| 发表于 2006-12-19 23:33:19 | 显示全部楼层 来自 北京海淀

回复: 有没有返回当前星期几的函数?

Post by jim_yang
%a abbreviated weekday name (Sun)
%A full weekday name (Sunday)
%b abbreviated month name (Dec)
%B full month name (December)
%c date and time (Dec 2 06:55:15 1979)
%d day of the month (02)
%H hour of the 24-hour day (06)
%I hour of the 12-hour day (06)
%j day of the year, from 001 (335)
%m...


好像就是这个,我试试。。。。
回复

使用道具 举报

游客
回复
您需要登录后才可以回帖 登录 | 注个册吧

快速回复 返回顶部 返回列表