Date Function

Returns a date as a formatted string value.

Date ([date][,format])  

Parameters

Date -  (Input, expression, Optional)

The date value to return. If date is specified as a string expression, Newlook will convert it to a date/time as long as it contains a date and/or time in the form “mmm d, yyyy” (e.g. “Feb 1, 1999”) and “hh:nn:ss”. If no date is given, then the current system date is assumed.

Format -  (Input, expression, Option)

The formatting string to return the date in (see the options below). If no format is given, the default date format is “dddd, d mmm yyyy”.

The following table shows the special characters that may be used within the format string:

d

Day of month (1-31)

dd

Day of month (01-31)

ddd

First three letters of day (e.g. Sun)

dddd

Full day name (e.g. Sunday)

m

Month (1-12)

mm

Month (01-12)

mmm

First three letters of month (e.g. Jan)

mmmm

Full month name (e.g. January)

q

Quarter (1-4)

w

Day of week (1-7)

ww

Week of year (1-53)

y

Day of year (1-366)

yy

Year (01)

yyyy

Full year (2001)

h

Hour (0-23) (24 hour)

hh

Hour (00-23) (24 hour)

H

Hour (1-12) (12 hour)

HH

Hour (01-12) (12 hour)

n

Minute (0-59)

nn

Minute (00-59)

s

Second (0-59)

ss

Second (00-59)

AM/PM

AM or PM

Am/pm

am or pm

A/P

A or P

A/p

a or p

Return Value

String containing the formatted date or Error if date is not a valid date/time.

Examples

Date()

Returns current date (default long format)

Date (Now())

Returns current date (default long format)

Date (Now(), “dd/mm/yy”)

Returns current date in DD/MM/YY format

Date (Error)

Returns

TIP:

Functions are specifically for use in the Macro Editor. Refer to Microsoft's official VB and JScript documentation for scripting equivalents.

See Also

Date function | DateAdd function | DateDiff function | Day function | Hour function | Minute function | Month function | Now function | Second function | Time function | Week function | WeekDay function | Year function


© 2004-2021 looksoftware. All rights reserved.