Date(), DateTime(), Time()
Date(), DateTime() and Time() return values for the present. Starting in VFP 6.0, Date() and DateTime() can be used to return any specified date or datetime in a Year-2000-compliant format. Usage | ldDate = DATE( [ nYear, nMonth, nDay ] ) ltDateAndTime = DATETIME( [ nYear, nMonth, nDay [, nHours [, nMinutes [, nSeconds ] ] ] ]) lcTheTime = TIME( [ uShowFractions ] ) |
Parameter | Value | Meaning |
nYear | 100 – 9999 | The year of the date variable to create. Note that dates in the years 1753 and before could cause problems, because the Gregorian calendar wasn't standardized until then. |
nMonth | 1 – 12 | The month of the variable to create. |
nDay | 1 – 31 | The day of the variable to create. |
nHours | 0 – 23 | Unlike the "strict date" format, this function accepts 24-hour based time. That makes sense—it would be a pain to have to pass two parameters. |
nMinutes | 0 – 59 | The number of minutes to assign to the datetime return value. |
nSeconds | 0 – 59 | The number of seconds in the return value. |
uShowFractions | Any type will do | Display the time with tenths and hundredths of a second. |
Example | ? "TODAY IS ", DATE() && returns "04/15/1998" * Calculate the date of the next New Year's Day ldNewYears = DATE(1+YEAR(DATE()),1,1) ? DATETIME() && returns "04/15/1998 23:15:22" ? TIME() && returns "23:15:22" ? TIME(1) && returns "23:15:22.15" |
See Also | CToD(), CToT(), Day(), DoW(), DMY(), DToC(), DToT(), GoMonth(), Hour(), MDY(), Minute(), Month(), Sec(), Seconds(), Set Century, Set Date, Set Hours, Set Mark To, Set Seconds, Set StrictDate, Set SysFormats, Sys(2), Sys(10), Sys(11), TToC(), TToD(), Year() |
View Updates
Copyright © 2002 by Tamar E. Granor, Ted Roche, Doug Hennig, and Della Martin. All Rights Reserved.