DateTime$ Function

Purpose

Converts a Date to a string.

Syntax

$ = DateTime$(date)

date: Date expression

Description

Together with Date$() and Time$() the function Now$ and DateTime$() converts a date to a printable string. The output format is set with Mode Date and Mode Time. DateTime$ includes both the date and the time part.

Example

Debug.Show

Trace DateTime$(Now)

Trace Now$

// Prints the actual date and time

Trace DateTime$(Date)

// Prints only the actual date

Trace DateTime$(11111.1111)

// Prints 06/02/1930 02:34:59

Local d As Date = 31344.55

Trace d

Trace DateTime$(d / 4 - 2 * 3)

// Prints 06/08/1921 03:18:00

Trace DateTime$(d)

// Prints 10/24/1985 13:12:00

See Also

CDate(), Date, Date$, DateAdd(), DateDiff(), DatePart(), DateSerial(), DateTime$(), DateToDmy, DateToDmyHms, DateValue(), Day(), DayNo(), DmyHmsToDate(), DmyToDate(), HmsToTime(), Hour(), IsDate(), Minute(), Month(), Now, Now$(), TimeSerial(), TimeToHms, TimeValue(), Second(), Week(), WeekDay(), Year()

{Created by Sjouke Hamstra; Last updated: 28/09/2014 by James Gaite}