SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftMask/OCX 7.0 - Masked Edit Control
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftPrintPreview/DLL 2.0 - Print Preview Control (discontinued)
SftTree/DLL 7.5 - Tree Control
SftBox/OCX 5.0 - Combo Box Control
SftButton/OCX 3.0 - Button Control
SftDirectory 3.5 - File/Folder Control (discontinued)
SftMask/OCX 7.0 - Masked Edit Control
SftOptions 1.0 - Registry/INI Control (discontinued)
SftPrintPreview/OCX 1.0 - Print Preview Control (discontinued)
SftTabs/OCX 6.5 - Tab Control (VB6 only)
SftTree/OCX 7.5 - Tree Control
SftTabs/NET 6.0 - Tab Control (discontinued)
SftTree/NET 2.0 - Tree Control
Converts a time into a displayable string.
VB.NET | object.FormatTime(ByVal Dt As Date, ByRef Text As String) |
VB | object.FormatTime(ByVal Dt As Date, Text As String) |
C#.NET | void object.FormatTime(System.DateTime Dt, ref string Text); |
VC++ | HRESULT object->FormatTime(DATE Dt, _bstr_t* Text); |
C | HRESULT object->raw_FormatTime(DATE Dt, BSTR* Text); |
object
Dt
The time to be converted to a string. The converted time is returned in the Text argument.
Text
Defines the desired formatting for the specified Time Dt and returns the converted time as a string. If an empty string is specified, the time is formatted using the default user locale.
The FormatTime method converts a time into a displayable string.
The FormatTime method uses the Windows GetTimeFormat API to format the specified time Dt.
Text can be defined as an empty string or can consist of one or more of the following items:
Text | Description |
---|---|
h | Hours without leading zero for single-digit hours - 12-hour clock |
hh | Hours with leading zero for single-digit hours - 12-hour clock |
H | Hours without leading zero for single-digit hours - 24-hour clock |
HH | Hours with leading zero for single-digit hours - 24-hour clock |
m | Minutes without leading zero for single-digit minutes |
mm | Minutes with leading zero for single-digit minutes |
s | Seconds without leading zero for single-digit seconds |
ss | Seconds with leading zero for single-digit seconds |
t | One character time-marker string, such as A or P. |
tt | Full length, multicharacter time-marker string, such as AM or PM |
Literal characters must be enclosed by single quotes.
Text = "hh':'mm':'ss tt"
To specify a literal single quote, use two quotes.
Calendar.FormatTimeV 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.
Text = "dddd, MMMM d 'in the year' yyyy" AxSftMask1.Calendar.FormatDate(#8/1/2000#, Text) MsgBox(Text) AxSftMask1.Calculator.FormatNumber(48533.85, -1, -1, -1, "", "", -1, FmtVal) MsgBox(FmtVal) 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)
Text = "dddd, MMMM d 'in the year' yyyy" SftMask1.Calendar.FormatDate #8/1/2000#, Text MsgBox (Text) SftMask1.Calculator.FormatNumber 48533.85, -1, -1, -1, "", "", -1, FmtVal MsgBox (FmtVal) 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
Text = "dddd, MMMM d 'in the year' yyyy"; axSftMask1.Calendar.FormatDate(new DateTime(2000, 8, 1), ref Text); MessageBox.Show(Text); axSftMask1.Calculator.FormatNumber(48533.85, -1, -1, -1, "", "", -1, out FmtVal); MessageBox.Show(FmtVal); 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);
m_pMask1->Calendar->FormatDate(COleDateTime(2000, 8, 1, 0,0,0), &FmtVal); AfxMessageBox(CString(FmtVal)); m_pMask1->Calculator->FormatNumber(48533.85, -1, -1, -1, _bstr_t(_T("")), _bstr_t(_T("")), -1, &FmtVal); AfxMessageBox(CString(FmtVal)); FmtVal = _T(""); 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;
See Also SftMaskCalendar Object | Object Hierarchy