Tuesday, December 21, 2004

Date Time Format

Here is the function to get the Date and Time



Now() : Returns the current date & time like this .... 12/16/2004 5:38:13 AM

Date() : Returns the current date like this ....12/16/2004

Time() : Returns the current time like this ....5:38:13 AM

Year(Now()) : Returns the current year like this ....2004

Month(Now()) : Returns the current month like this ....12

Day(Now()) : Returns the current day like this ....16

Hour(Now()) : Returns the current hour like this ....5

Minute(Now()) : Returns the current minute like this ....38

Second(Now()) : Returns the current second like this ....13



FormatDateTime(Now(), 0) : Returns the current date & time like this ....12/16/2004 5:38:13 AM

FormatDateTime(Now(), 1) : Returns the current date like this ....Thursday, December 16, 2004

FormatDateTime(Now(), 2) : Returns the current date like this ....12/16/2004

FormatDateTime(Now(), 3) : Returns the current time like this ....5:38:13 AM

FormatDateTime(Now(), 4) : Returns the current time like this ....05:38

MonthName(Month(Now())) : Returns the current month like this ....December

MonthName(Month(Now()), 1) : Returns the current month like this ....Dec

WeekDay(Now()) : Returns the current day like this ....5

WeekDayName(WeekDay(Now())) : Returns the current day like this ....Thursday

WeekDayName(WeekDay(Now()), 1) : Returns the current day like this ....Thu



DateAdd("d", 10, Now()) : Returns what the date will be in 10 days time like this ....12/26/2004 5:38:13 AM

DateAdd("d", -3, Now()) : Returns what the date was 3 days ago like this ....12/13/2004 5:38:13 AM

DateDiff("d", "24/3/2002", Now()) : Returns the number of days that have passed since the 24th of March 2002

998

Day(Now()) & "/" & Month(Now()) & "/" & Year(Now()) : Returns the date in typical UK format 16/12/2004

Month(Now()) & "/" & Day(Now()) & "/" & Year(Now()) : Returns the date in typical USA format 12/16/2004

WeekDayName(WeekDay(Now())) & ", " & Day(Now()) & " " & MonthName(Month(Now())) & ", " & Year(Now()) : Returns today's date like this ...... Thursday, 16 December, 2004


No comments: