Visit our new web pages

We have launched a new extended set of web pages at www.alvechurchdata.co.uk. These old pages will stay on the server because people still have links to them but they will not be updated.

The new version of this page is at www.alvechurchdata.co.uk/hints-and-tips/accdate.html.

Access Date Functions


This list gives a brief description of the most useful date functions in Access. Access Help gives more details and will describe exactly how these functions operate in your version of Access.

Note that functions are always followed by a pair of brackets even if - like Date() - there's nothing in them. The Access editor will sometimes remove these brackets but by entering them you are telling Access that you are attempting to use a function.

Date() Gives today's date. Date$() gives it as a string. There is also a Date command which sets the system date.
Day(<date>) Gives the day of the month (1 .. 31) of <date>.
DateAdd(<interval>,<number>,<date>) Adds an interval to <date>. The intervals can be anything from seconds to years.
DateDiff(<interval>, <date1>, <date2>) Subtracts <date2> from <date1> and gives the result in the unit specified as <interval>.
DatePart(<interval>, <datetime>) Extracts part of <datetime>, for example the minute, week or quarter.
Format(<datetime>, <format>) Returns <datetime> as a text string in the format specified.
Hour(<time>) Returns the hour of <time> as a number from 0 to 23.
Minute(<time>) Returns the minute of <time> as a number from 0 to 59.
Month(<date>) Returns the month number of <date>.
Now() Returns the current date and time.
Second(<time>) Returns the second of <time> as a number from 0 to 59.
Time() Returns the current time. Time$()gives it as a string. There is also a Time command which sets the system time.
WeekDay(<date>) Gives the day of the week as a number from 1 to 7.
Year(<date>) Returns the year number of <date>.

Other functions

Access logical functions
Access numeric functions
Access text functions


Hints & tips

The textbox class in Visual FoxPro 9 has a new Autocomplete property which shows the user the previous values that have been entered in that textbox.
Autocomplete in VFP 9

Your Access database will look more impressive if you add custom toolbars...
Custom toolbars

FoxPro has always had functions to read and write files at a low level...
Foxpro low level file functions

More...
More pages of hints and tips for users of Microsoft FoxPro and Access databases.

Site Map