1)如何单独获取系统的年,月,日,时分秒,星期~
2)如何单独获取农历的年,月,日;
2)如何单独获取农历的年,月,日;
解决方案 »
- 调用sendmessage给IE窗体 classname'#32770' windowname'选择要上传的档案' 的edit1传送字串
- 代码看不明白。大虾帮忙。
- videocap视频输出大小问题?急急急
- 客户程序访问远程COM+组件时出现“拒绝访问”(在一次断电后出现,之前正常)
- 请问在程序运行中怎么才能给一个表动态的增添或删除字段啊?
- 请帮我读取pdb格式文件中的数据
- 三层结构,中间层query,dataprovider客户端用clientdataset,datasource,在客户端用dbgrideh显示数据,怎样添加数据!
- 求帮助,求指教
- 请各位赏个脸看一下,我都快疯了
- 一个奇怪的问题,对于你也许很简单,告诉我吧 !!! *^_^*
- 怎样获取进程的的主窗体句柄,并向它发送虚拟键消息 急,大家帮帮忙啊!!!!
- createwindow出的Edit不能获得支持移动键盘左、右键的困惑?
农历?自己要写对应的转换函数了
DateUtils;
------------------------
YearOf()取得指定日期的年份
MonthOf()取得指定日期的月份
DayOf()取得指定日期的天数
DayOfWeek()取得星期
.......
DateUtils;
------------------------
YearOf()取得指定日期的年份
MonthOf()取得指定日期的月份
DayOf()取得指定日期的天数
DayOfWeek()取得星期
.......用这个不行啊~
报这个错哦~[Error] XXX.pas(106): Incompatible types: 'String' and 'Word'
怎么办呢~
Label1.Caption:=YearOf(Date)+'年';
import java.text.SimpleDateFormat;
public class date
{
public void getTime()
{
Calendar cal = Calendar.getInstance();
cal.setTime(new Date());
String year = String.valueOf(cal.get(Calendar.YEAR)),
month = String.valueOf(cal.get(Calendar.MONTH)+1), //Calendar.Month 为0,表示一月
date = String.valueOf(cal.get(Calendar.DAY_OF_MONTH)),
week = String.valueOf(cal.get(Calendar.DAY_OF_WEEK) - 1); //求星期几
System.out.println(year+'年'+ month + "月" + date + "日 " + "星期" + week);
Date nowTime = new Date();
SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss G E D F w W a E F");
System.out.println("现在时间:" + f.format(nowTime));
//求相隔天数
cal.set(2005,8,2);
long t1 = cal.getTimeInMillis();
cal.set(Integer.parseInt(year),Integer.parseInt(month),Integer.parseInt(date)); //today
long t2 = cal.getTimeInMillis();
long intervalDates = (t2 -t1)/(1000*60*60*24);
System.out.println("intervalDays: " + intervalDates);
//输出当前月的日历页
System.out.println(" 日 一 二 三 四 五 六");
cal.set(Integer.parseInt(year),Integer.parseInt(month) - 1 ,1); //today
// cal.set(2005,6,1);
// int y = Integer.parseInt(year);//cal.get(cal.get(Calendar.YEAR));
// int m = Integer.parseInt(month);//cal.get(Calendar.MONTH)+1;
//cal.set(y,m,1);
// cal.set(y,m-1,1);
int noweek = cal.get(Calendar.DAY_OF_WEEK) - 1;
System.out.println("星期"+noweek + "年"+ y +"月"+ m);
String a[] = new String[noweek + 31];
for(int i = 0; i < noweek; i++)
{
a[i]= "**";
}
for(int i = noweek ,n = 1; i<noweek+31; i++){
if(n<=9)
a[i] = " " + String.valueOf(n);
else
a[i] = String.valueOf(n);
n++;
}
//输出数组
for(int i = 0; i<a.length; i++){
if(i%7 == 0){
System.out.println("");
}
System.out.print(" " + a[i]);
}
}
}
Format('MM', Now) 月
Format('DD', Now) 日
Format('DDD', Now) 星期几
谢谢你~行了~
呵呵~我真的是个菜鸟.这点都没看出来~再次谢谢你`