Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
05 ArchiCAD 11 GDL Reference Guide.pdf
Скачиваний:
58
Добавлен:
11.03.2015
Размер:
3.22 Mб
Скачать

Miscellaneous

GDL DATETIME ADD-ON

The DateTime extension allows you to set various formats for the current date and time set on your computer.

The Add-On works the same way the GDL file operations. You have to open a channel, read the information and close the channel.

This Add-On is also available by using the REQUEST GDL command, in which case the sequence of commands OPEN, INPUT and CLOSE is called internally. This is the simplest way to obtain the date/time information, with just a single GDL command line:

REQUEST ("DateTime", format, datetimestring)

The second parameter of the Request function is the same as that described in the OPEN function paramstring parameter.

Opening Channel

channel = OPEN (filter, filename, paramstring)

filter: the internal name of the Add-On, in this case "DateTime"

filename: unused (there is no need to open any file to get the system date and time)

paramstring: add-on specific parameter, contains the desired output format of the date and time

Its return value is a positive integer that will identify the opened channel. This value will become the channel's future reference number. The paramstring can contain specifiers and other characters.

ArchiCAD 11 GDL Reference Guide

299

Miscellaneous

The specifiers are replaced with date and time values as follows:

%a

abbreviated weekday name

%A

full weekday name

%b

abbreviated month name

%B

full month name

%c

date and time in the form: 01:35:56 PM Wednesday, March 27, 1996

%d

day of the month as a decimal number (01-31)

%H

hour (24-hour clock), as a decimal number (00-23)

%I

hour (12-hour clock), as a decimal number (01-12)

%j

day of the year, as a decimal number (001-366)

%m

month, as a decimal number (01-12)

%M

minute, as a decimal number (00-59)

%P

AM/PM designation for a 12-hour clock

%S

second, as a decimal number (00-61)

%U

week number of the year (with Sunday as the first day of the first week), as a decimal number

%w

weekday, as a decimal number (0 (Sunday)-6 (Saturday))

%W

week number of the year (with Monday as the first day of the first week), as a decimal number (00-53)

%x

date in the form Wednesday, March 27, 1996

%X

time in the form 01:35:56 PM

%y

year without century, as a decimal number (00-99)

%Y

year with century, as a decimal number

%Z

GDL ignores this specifier. According to the standard, it prints the time zone if it can be determined

%%the % character

Example: dstr = ""

ch = OPEN ("DateTime", "", "%w/%m/%d/%Y, %H:%M%P") n = INPUT (ch, "", "", dstr)

CLOSE (ch)

PRINT dstr !it prints 3/03/27/1996, 14:36 PM

300

ArchiCAD 11 GDL Reference Guide