getdate,是一个函数术语,GETDATE() 函数从 SQL Server 返回当前的时间和日期。
getdate,是一个函数术语,GETDATE() 函数从 SQL Server 返回当前的时间和日期。
功 能: GETDATE() 函数从 SQL Server 返回当前的时间和日期。
列:SELECT GETDATE() AS CurrentDateTime
结果:
CurrentDateTime |
|---|
2008-12-29 16:25:46.635 |
列:--取时间的某一个部分
select datepart(yy,getdate()) --year
select datepart(mm,getdate()) --month
select datepart(dd,getdate()) --day
select datepart(hh,getdate()) --hour
select datepart(mi,getdate()) --min
select datepart(ss,getdate()) --sec
函数名: getdate
功 能: 取DOS日期
用 法: void getdate(struct *dateblk);
程序例:
#include<stdio.h>
#include <dos.h>
int main(void)
{
struct date d;
getdate(&d);
printf("The current year is: %dn",
d.da_year);
printf("The current day is: %dn",
d.da_day);
printf("The current month is: %dn",
d.da_mon);
return 0;
}
在VC++6.0中运行上述程序不能通过,原因是此版本的<dos.h>中不包含getdate函数。
但在TurboC 中运行可以通过。