Hide

SftMask/OCX 7.0 - ActiveX Masked Edit Control

Display
Print

GetDateInfo Method, SftMaskCalendar Object

Converts a date into its components.

Syntax

VB.NETobject.GetDateInfo(ByVal Dt As Date, ByRef Year As Short, ByRef Month As Short, ByRef Day As Short, ByRef DayOfWeek As Short)
VBobject.GetDateInfo(ByVal Dt As Date, Year As Integer, Month As Integer, Day As Integer, DayOfWeek As Integer)
C#.NETvoid object.GetDateInfo(System.DateTime Dt, out short Year, out short Month, out short Day, out short DayOfWeek);
VC++HRESULT object->GetDateInfo(DATE Dt, short* Year, short* Month, short* Day, short* DayOfWeek);
CHRESULT object->raw_GetDateInfo(DATE Dt, short* Year, short* Month, short* Day, short* DayOfWeek);

object

A SftMaskCalendar object.

Dt

The date to be converted.

Year

Returns the year as specified by Dt.

Month

Returns the month as specified by Dt, a value in the range 1-12.

Day

Returns the day as specified by Dt, a value in the range 1-31.

DayOfWeek

Returns the day of the week (Sunday = 0, Monday = 1, etc.).

Comments

The GetDateInfo method converts a date into its components.

GetDateInfo can be used to convert a date into its month, day, year components. Calendar.GetTimeInfo is used to retrieve the time related components.

Calendar.GetDateInfoV is used for languages such as VBScript, which are limited by requiring Variant arguments and do not support strongly typed arguments for return values. For more information please see Using SftMask/OCX with Internet Explorer.

Examples

VB.NET

    Text = ""
    AxSftMask1.Calendar.FormatTime(#5:01:59 PM#, Text)
    MsgBox(Text)
    Text = "'Hour='H 'Mins='m 'Secs='s"
    AxSftMask1.Calendar.FormatTime(#5:01:59 PM#, Text)
    MsgBox(Text)

    Dim Year As Integer, Month As Integer, Day As Integer, DayOfWeek As Integer
    AxSftMask1.Calendar.GetDateInfo(#7/14/2006 5:49:23 PM#, Year, Month, Day, DayOfWeek)
    MsgBox("Year=" & Year & " Month=" & Month & " Day=" & Day & " DayOfWeek=" & DayOfWeek)

    Dim Hours As Integer, Minutes As Integer, Seconds As Integer
    AxSftMask1.Calendar.GetTimeInfo(#7/14/2002 5:49:23 PM#, Hours, Minutes, Seconds)
    MsgBox("Hours=" & Hours & " Minutes=" & Minutes & " Seconds=" & Seconds)
End Sub

VB6

    Text = ""
    SftMask1.Calendar.FormatTime #5:01:59 PM#, Text
    MsgBox (Text)
    Text = "'Hour='H 'Mins='m 'Secs='s"
    SftMask1.Calendar.FormatTime #5:01:59 PM#, Text
    MsgBox (Text)

    Dim Year As Integer, Month As Integer, Day As Integer, DayOfWeek As Integer
    SftMask1.Calendar.GetDateInfo #7/14/2006 5:49:23 PM#, Year, Month, Day, DayOfWeek
    MsgBox ("Year=" & Year & " Month=" & Month & " Day=" & Day & " DayOfWeek=" & DayOfWeek)

    Dim Hours As Integer, Minutes As Integer, Seconds As Integer
    SftMask1.Calendar.GetTimeInfo #7/14/2002 5:49:23 PM#, Hours, Minutes, Seconds
    MsgBox ("Hours=" & Hours & " Minutes=" & Minutes & " Seconds=" & Seconds)
End Sub

C#

    Text = "";
    axSftMask1.Calendar.FormatTime(new DateTime(2000, 8, 1, 5, 1, 59), ref Text);
    MessageBox.Show(Text);
    Text = "'Hour='H 'Mins='m 'Secs='s";
    axSftMask1.Calendar.FormatTime(new DateTime(2000, 8, 1, 5, 1, 59), ref Text);
    MessageBox.Show(Text);

    short Year, Month, Day, DayOfWeek;
    axSftMask1.Calendar.GetDateInfo(new DateTime(2006, 7, 14, 5, 49, 23), out Year, out Month, out Day, out DayOfWeek);
    MessageBox.Show("Year=" + Year.ToString() + " Month=" + Month.ToString() + " Day=" + Day.ToString() + " DayOfWeek=" + DayOfWeek.ToString());

    short Hours, Minutes, Seconds;
    axSftMask1.Calendar.GetTimeInfo(new DateTime(2006, 7, 14, 5, 49, 23), out Hours, out Minutes, out Seconds);
    MessageBox.Show("Hours=" + Hours.ToString() + " Minutes=" + Minutes.ToString() + " Seconds=" + Seconds.ToString());
}

C++

    m_pMask1->Calendar->FormatTime(COleDateTime(2000, 8, 1, 5, 1, 59), &FmtVal);
    AfxMessageBox(CString(FmtVal));

    FmtVal = _T("'Hour='H 'Mins='m 'Secs='s");
    m_pMask1->Calendar->FormatTime(COleDateTime(2000, 8, 1, 5, 1, 59), &FmtVal);
    AfxMessageBox(CString(FmtVal));

    short Year, Month, Day, DayOfWeek;
    m_pMask1->Calendar->GetDateInfo(COleDateTime(2000, 7, 14, 5,49,23), &Year, &Month, &Day, &DayOfWeek);
    CString str;
    str.Format(_T("Year=%d Month=%d Day=%d DayOfWeek=%d"), Year, Month, Day, DayOfWeek);
    AfxMessageBox(str);

    short Hours, Minutes, Seconds;
    m_pMask1->Calendar->GetTimeInfo(COleDateTime(2000, 7, 14, 5,49,23), &Hours, &Minutes, &Seconds);
    str.Format(_T("Hours=%d Minutes=%d Seconds=%d"), Hours, Minutes, Seconds);

See Also SftMaskCalendar Object | Object Hierarchy


Last Updated 08/13/2020 - (email)
© 2024 Softel vdm, Inc.