VS:Date

From Vectorworks Developer
Revision as of 10:26, 12 August 2013 by Root (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

.VectorScript|VectorScript ..VS:Function Reference|Function Reference ..VS:Function_Reference_Appendix|Appendix

Description

Function Date returns a formatted date and time string.


Table - Values for dateFormat parameter
Date Format Constant
Full Date 0
Abbreviated Date 1
Short Date 2
Table - Values for infoFormat parameter:
Date/Time Constant
Date only 0
Date and Time 1
Time only 2
FUNCTION Date(
dateFormat  :INTEGER;
infoFormat  :INTEGER) : STRING;
def vs.Date(dateFormat, infoFormat):
    return STRING

Parameters

dateFormat INTEGER Specify how verbose or compact the resulting string is.
infoFormat INTEGER Specify if result should contain date, time or both.

Remarks

From Vectorlab, 2006:
  • Short date always returns MM/DD/YY regardless of your system settings.
  • Day and month can return one or two digits, so use the "/" character to parse the values. The year is always 2 digits.
  • The hour can also return one or two digits but minutes and seconds always return two digits, so use the ":" character to parse the values.
  • the time is a 12-hour clock, not 24-hour. Use the Pos() function to detect the AM or PM suffix.

At least on Windows, some of the return values are dependent on the user's operating system date format settings.

From Gideon Scott on the tech board: WinXP > Control Panel > Regional and Language Options > Advanced > Language for non-Unicode programs...

The default setting of "English (United States)" affects the VW date format rather than the date settings under the normal "Regional Options" tab.

Example

VectorScript

{ All examples are for the date Friday,  }
{ Nov. 18, 1988 and the time 10:42:24 AM }

Message.(Date(0,1));
{returns Friday, November 18, 1988 10:42:24 AM}

Message.(Date(0,0));
{returns Friday, November 18, 1988}

Message.(Date(2,2));
{returns 10:42:24 AM}

Message.(Date(2,1));
{returns 11/18/88 10:42:24 AM}

Python

#{ All examples are for the date Friday,  }
#{ Nov. 18, 1988 and the time 10:42:24 AM }

vs.Message(vs.Date(0,1))
#{returns Friday, November 18, 1988 10:42:24 AM}

vs.Message(vs.Date(0,0))
#{returns Friday, November 18, 1988}

vs.Message(vs.Date(2,2))
#{returns 10:42:24 AM}

vs.Message(vs.Date(2,1))
#{returns 11/18/88 10:42:24 AM}

Version

Availability: from All Versions
Personal tools
NamespacesFFFF

Variants
Actions
Advanced Search
See Also
Navigation
Toolbox