MIDAT Control

Description

The Mitromar, Inc. Date/Time custom control MIDAT.VBX is designed to speed up processing whenever you have the need for current date or time information in your programs.  Rather than using the Format(NOW) function, you can simply use the MIDAT.VBX property FormattedTime.  The property is always a formatted string, formatted in one of thirteen choices.  The formatting choices include combinations of date and time, just date, or just time.  They offer 24 or 12 hour formats.  Other properties will also simplify most of your date and time related requirements.

File Name

MIDATXXX.VBX where XXX is the version number.

Remarks

MIDAT.VBX  comes in two versions, test and licensed.  You can tell which version you have by selecting the About property in the design mode and clicking the ellipse (...).  The dialog will indicate whether this is the test or licensed version.  The test version has an expiration date.  To order  the licensed version call Mitromar, Inc. at 407-276-2091.

Properties

AmPm	BackColor 	CtlName	Date

DayofMonth	DayofYear 	DisplayFormat	Enabled

FirstWeek	FontBold	FontItalic	FontName

FontSize	FontUnderline	ForeColor	FormattedTime

Height	Hour24	HourTwelve	Index

Interval	LastStatus 	Left	Minute

Month	MonthAbbr 	MonthName	Seconds

Separator	Time 	TimeZone	Top

Visible	WeekDay	WeekDayAbbr	 WeekDayName

WeekofYear 	Width	Year

Events

Change	Timer

Methods

Refresh


AmPm Property, MIDAT Control

Description

AmPm is a literal that indicates whether the time is before noon or after noon.  This property is read only.  It is updated whenever a property is requested, the DisplayFormat property is set, the Refresh method is invoked, or when the Timer event, if active, occurs.

Usage

Value$= [form.]MIDAT.AmPm

Settings

AM = Before Noon.

PM = After Noon.

Data Type

String


Date Property, MIDAT Control

Description

Date is a literal that contains the calendar date.  This property is read only.  It is updated whenever a property is requested, the DisplayFormat property is set, the Refresh method is invoked, or when the Timer event, if active, occurs.

Usage

Value$= [form.]MIDAT.Date

Settings

This value is always MM/DD/YY format.

Data Type

String


DayofMonth Property, MIDAT Control

Description

DayofMonth is the calendar day of the current month.  This property is read only.  It is updated whenever a property is requested, the DisplayFormat property is set, the Refresh method is invoked, or when the Timer event, if active, occurs.

Usage

Value% =[form.]MIDAT.DayofMonth

Settings

This is the numeric day of the month, (1 to 31).

Data Type

Integer


DayofYear Property, MIDAT Control

Description

DayofYear is the day of the year.  Jan 1 is 1, Feb. 1 is 32.  This property is read only.  It is updated whenever a property is requested, the DisplayFormat property is set, the Refresh method is invoked, or when the Timer event, if active, occurs.

Usage

Value% =[form.]MIDAT.DayofYear

Settings

This is the numeric day of the year (1 to 366).

Data Type

Integer


DisplayFormat Property, MIDAT Control

Description

DisplayFormat determines formatting for the date and time of the value in the property FormattedTime.  There are thirteen settings for DisplayFormat. Setting this Property produces a Change event.

Usage

 [form.]MIDAT.DisplayFormat = Value%

Value% =[form.]MIDAT.DisplayFormat

Settings

Default Settings : 0	mm/dd/yy hh:mm:ss

The DisplayFormat Property settings are:

Setting	Description

0	mm/dd/yy hh:mm:ss

1 	yy/mm/dd hh:mm;ss

2 	dd/mm/yy hh:mm:ss

3 	mm/dd/yy 24:mm:ss

4 	yy/mm/dd 24:mm;ss

5 	dd/mm/yy 24:mm:ss

6 	mm/dd/yy

7 	yy/mm/dd

8 	dd/mm/yy

9 	hh:mm:ss

10 	hh:mm

11 	24:mm:ss

12 	24:mm

Data Type

Integer - Enumeration


FormattedTime Property, MIDAT Control

Description

FormattedTime is the date/time string as specified in the DisplayFormat property.  This property is read only.  It is updated whenever a property is requested, the DisplayFormat property is set, the Refresh method is invoked, or when the Timer event, if active, occurs.

Usage

Value$=[form.]MIDAT.FormattedTime

Settings

This property is the string specified by the DisplayFormat property.

Data Type

String


Hour24 Property, MIDAT Control

Description

Hour24 is the military or 24 hour clock value.  This property is read only.  It is updated whenever a property is requested, the DisplayFormat property is set, the Refresh method is invoked, or when the Timer event, if active, occurs.

Usage

Value% =[form.]MIDAT.Hour24

Settings

This is the numeric hour (0 to 23).

Data Type

Integer


HourTwelve Property, MIDAT Control

Description

HourTwelve is the hour using the AmPm Property.  This property is read only.  It is updated whenever a property is requested, the DisplayFormat property is set, the Refresh method is invoked, or when the Timer event, if active, occurs.

Usage

Value% =[form.]MIDAT.HourTwelve

Settings

This is the numeric hour (1 to 12).

Data Type

Integer


Interval Property, MIDAT Control

Description

Interval is the Timer duration in milliseconds.  When the duration elapses, the Timer event occurs.  Setting the Interval to 0 deactivates the Timer event.  Any negative value for this property results in an Interval of 1000 Milliseconds, (one second). Setting this Property produces a Change event.

Usage

Value% =[form.]MIDAT.Interval

Settings

Default Settings = 0 	(No timer active).

Range 0 to 65535

Data Type

Integer


LastStatus Property, MIDAT Control

Description

LastStatus is an informational property that gives the status of  control functions.  The constants for using this property are in the file MIDATTIM.BAS.  This property is read only.  It is updated whenever a property is requested, the DisplayFormat property is set, the Refresh method is invoked, or when the Timer event, if active, occurs.

Usage

Value% =[form.]MIDAT.LastStatus

Settings

ISTATUS_MIDAT_NO_CHANGE	1

ISTATUS_MIDAT_NO_PROBLEM	0

ISTATUS_MIDAT_FORCE_ONE_SECOND	-1

ISTATUS_MIDAT_NO_TIMER_AVAILABLE	-2

Data Type

Integer


Minute Property, MIDAT Control

Description

Minute is the minute after the hour.  This property is read only.  It is updated whenever a property is requested, the DisplayFormat property is set, the Refresh method is invoked, or when the Timer event, if active, occurs.

Usage

Value% =[form.]MIDAT.Minute

Settings

This is the numeric minute (0 to 59).

Data Type

Integer


Month Property, MIDAT Control

Description

Month is the calendar month of the year. This property is read only.  It is updated whenever a property is requested, the DisplayFormat property is set, the Refresh method is invoked, or when the Timer event, if active, occurs.

Usage

Value% =[form.]MIDAT.Month

Settings

This is the numeric month (1 to 12).

Data Type

Integer


MonthAbbr Property, MIDAT Control

Description

This is the calendar month abbreviation.  This property is read only.  It is updated whenever a property is requested, the DisplayFormat property is set, the Refresh method is invoked, or when the Timer event, if active, occurs.

Usage

Value$=[form.]MIDAT.MonthAbbr

Settings

"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"

Data Type

String


MonthName Property, MIDAT Control

Description

This is the complete calendar month name.  This property is read only.  It is updated whenever a property is requested, the DisplayFormat property is set, the Refresh method is invoked, or when the Timer event, if active, occurs.

Usage

Value$=[form.]MIDAT.MonthName

Settings

"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"

Data Type

String


Seconds Property, MIDAT Control

Description

Seconds is the number of seconds after the minute.  This property is read only.  It is updated whenever a property is requested, the DisplayFormat property is set, the Refresh method is invoked, or when the Timer event, if active, occurs.

Usage

Value% =[form.]MIDAT.Seconds

Settings

This is the numeric seconds (0 to 59).

Data Type

Integer


Time Property, MIDAT Control

Description

This property always contains the current  time.  This property is read only.  It is updated whenever a property is requested, the DisplayFormat property is set, the Refresh method is invoked, or when the Timer event, if active, occurs.

Usage

Value$=[form.]MIDAT.Time

Settings

This property is always in the format HH:MM:SS.

Data Type

String


TimeZone Property, MIDAT Control

Description

TimeZone is the time zone specified in the TZ environment variable.  The default TZ setting is PDT.  This property is read only.  It is updated whenever a property is requested, the DisplayFormat property is set, the Refresh method is invoked, or when the Timer event, if active, occurs.

Usage

Value$=[form.]MIDAT.TimeZone

Data Type

String


WeekDay Property, MIDAT Control

Description

WeekDay is the numeric day of the week.  Sunday is 1.   This property is read only.  It is updated whenever a property is requested, the DisplayFormat property is set, the Refresh method is invoked, or when the Timer event, if active, occurs.

Usage

Value%=[form.]MIDAT.WeekDay

Settings

This is the numeric day of the week (1 to 7).

Data Type

Integer


WeekDayAbbr Property, MIDAT Control

Description

WeekDayAbbr is the literal for the day of the week.  This property is read only.  It is updated whenever a property is requested, the DisplayFormat property is set, the Refresh method is invoked, or when the Timer event, if active, occurs.

Usage

Value$=[form.]MIDAT.WeekDayAbbr

Settings

"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"

Data Type

String


WeekDayName Property, MIDAT Control

Description

WeekDayName is the complete day of the week name.  This property is read only.  It is updated whenever a property is requested, the DisplayFormat property is set, the Refresh method is invoked, or when the Timer event, if active, occurs.

Usage

Value$=[form.]MIDAT.WeekDayName

Settings

"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"

Data Type

String


WeekofYear Property, MIDAT Control

Description

WeekofYear is the week during which the current day falls.  The first week is determined by the Setting of the FirstWeek Property.   A value of 0 (zero) is possible if the FirstWeek property is set to the First Sunday setting.  This property is read only.  It is updated whenever a property is requested, the DisplayFormat property is set, the Refresh method is invoked, or when the Timer event, if active, occurs.

Usage

Value%=[form.]MIDAT.WeekofYear

Settings

This is the numeric week of the year (0 to 52).

Data Type

Integer


Year Property, MIDAT Control

Description

Year is the year in its complete format (1995).  This property is read only.  It is updated whenever a property is requested, the DisplayFormat property is set, the Refresh method is invoked, or when the Timer event, if active, occurs.

Usage

Value%=[form.]MIDAT.Year

Settings

This is the numeric year.

Data Type

Integer


FirstWeek Property, MIDAT Control

Description

The FirstWeek Property setting determines when the first week of the year starts.  If the property is set to 0, then the first week starts with the first Sunday of the year.  The means that week 0 is possible whenever the first Sunday is not on January 1. Setting this Property produces a Change event.

Usage

Value%=[form.]MIDAT.FirstWeek

Settings

0 - First Sunday starts Week 1

1 - January 1 starts Week 1

Data Type

Integer


Separator Property, MIDAT Control

Description

The Separator Property determines the date separator used in formatting the Date and FormattedTime Properties.  Setting this Property produces a Change event.

Usage

Value%=[form.]MIDAT.Year

Settings

0 - / (Slash) Default

1 - - (Dash)

2 - . (Period)

3 - | (Bar)

Data Type

Integer


Now, VB vs Midat

The MIDATXXX.VBX performance improvement may be tested using the example program MIVB.MAK included with the MIDATXXX.VBX.  This program allows you to run timed comparisons between FORMAT(NOW) and the MIDAT1.FormattedTime property being assigned to a label caption.


Order, MIDAT Control

The MIDATXXX.VBX may be ordered by calling Mitromar, Inc  at  407-276-2091.  The licensed version of MIDATXXX.VBX will be sent  to you upon receipt of payment.  The price of the control is $25.00 US.  Suggestions, comments or other requirements are welcome.


Change Event, MIDAT Control

Description

This event occurs whenever the FormattedTime Property has been changed for any reason other than a Timer event.   The FormattedTime Property changes whenever Interval, DisplayFormat, FirstWeek, or Separator Properties are set, even if they are not changed (i.e. Midat1.Interval = Midat1.Interval).

Syntax

Sub MIDAT_Change ()

Remarks

This event does not occur as a result of the Timer event.


Timer Event, MIDAT Control

Description

The Timer event occurs when the Interval has elapsed.  The Timer event does not occur if the Interval is set to 0 or when there are no timers available to the program.

Syntax

Sub MIDAT_Timer ()

Remarks

The Timer event does not produce a Change Event.


Refresh Method, MIDAT Control

Description

The Refresh Method causes the control to refresh all properties. This is especially useful when using a Timer Interval is not desired or when the control is not visible.  Using the Refresh Method is the same as requesting any property value except that it does not cause a Change Event to occur.