CAPPS Reading Date & Time commands for DMIS

CAPPS Reading Date & Time commands for DMIS

 

Use the following commands to obtain date and time information during DMIS execution. It is recommended that this information is stored in a STRING type variable.

 

These commands can be used to directly read time / date values. The format of the data read is shown on the right.

 

This code can be directly copied into the CAPPS code. Use the System Display window to view the data during or after code simulation.

 

DECL/STRING,TD_VAR1,TD_VAR2,TD_VAR3,TD_VAR4,TD_VAR5,TD_VAR6,TD_VAR7,TD_VAR8,TD_VAR9,TD_VAR10

 

TD_VAR1 =DATE.MONTH                      1-12

TD_VAR2=DATE.MONTHA                     January-December

TD_VAR3=DATE.DAY                        1-31

TD_VAR4=DATE.DAY7                       1-7

TD_VAR5=DATE.DAYA                       Sunday-Saturday

TD_VAR6=DATE.YEAR                       2015 for example

TD_VAR7=TIME.HOUR12                     0-12

TD_VAR8=TIME.HOUR24                     0-23

TD_VAR9=TIME.MINUTE                     0-59

TD_VAR10=TIME.SECOND                     0-59

 

 

 

 



If the default formats are not suitable, the FORMAT command can be used to customize how the time / date values are read.

 

D=DATE.FORMAT_%A_%a%B             Formatted day and time string (Check the table below)

 

Directive

Meaning

Example Results

DATE.FORMAT%a

Locale's abbreviated weekday name.

Wed

DATE.FORMAT%A

Locale's full weekday name.

Wednesday

DATE.FORMAT%b

Locale's abbreviated month name.

Nov

DATE.FORMAT%B

Locale's full month name.

November

DATE.FORMAT%c

Locale's appropriate date and time representation

Wed Nov 27 11:52:29 2024

DATE.FORMAT%d

Day of the month as a decimal number

27

DATE.FORMAT%H

24-hour clock as a decimal number

11

DATE.FORMAT%I

12-hour clock as a decimal number

11

DATE.FORMAT%j

Day of the year as a decimal number

332

DATE.FORMAT%m

Month as a decimal number

11

DATE.FORMAT%M

Minute as a decimal number

52

DATE.FORMAT%p

Locale's equivalent of either AM or PM

AM

DATE.FORMAT%S

Seconds as a decimal number

29

DATE.FORMAT%U

Week number of the year -Sunday as first day of week - All days in a new year preceding the first Sunday are considered to be in week 0

47

DATE.FORMAT%w

Weekday as a decimal number - Sunday starts at 0

3

DATE.FORMAT%W

Week number of the year-Monday as first day of week - All days in a new year preceding the first Monday are considered to be in week 0

48

DATE.FORMAT%x

Locale's appropriate date representation

11/27/2024

DATE.FORMAT%X

locale's appropriate time representation

11:52:29

DATE.FORMAT%y

Year without century as a decimal

24

DATE.FORMAT%Y

Year with century as a decimal

2024

DATE.FORMAT%Z

Time Zone Name

US Eastern Standard Time

 

Sample DMIS code for reading system time / date values using the FORMAT command. This code can be directly copied into the CAPPS code. Use the System Display window to view the data during or after code simulation.

$$

DECL/STRING,VAR1,VAR2,VAR3,VAR4,VAR5,VAR6,VAR7,VAR8,VAR9,VAR10,VAR11,VAR12

DECL/STRING,VAR13,VAR14,VAR15,VAR16,VAR17,VAR18,VAR19,VAR20,VAR21

$$

$$

VAR1=DATE.FORMAT%a

VAR2=DATE.FORMAT%A

VAR3=DATE.FORMAT%b

VAR4=DATE.FORMAT%B

VAR5=DATE.FORMAT%c

VAR6=DATE.FORMAT%d

VAR7=DATE.FORMAT%H

VAR8=DATE.FORMAT%I

VAR9=DATE.FORMAT%j

VAR10=DATE.FORMAT%m

VAR11=DATE.FORMAT%M

VAR12=DATE.FORMAT%p

VAR13=DATE.FORMAT%S

VAR14=DATE.FORMAT%U

VAR15=DATE.FORMAT%w

VAR16=DATE.FORMAT%W

VAR17=DATE.FORMAT%x

VAR18=DATE.FORMAT%X

VAR19=DATE.FORMAT%y

VAR20=DATE.FORMAT%Y

VAR21=DATE.FORMAT%Z