다음을 통해 공유


DateTimeFormatInfo.ShortTimePattern 속성

't' 형식 문자와 관련된 간단한 시간 값의 형식 패턴을 가져오거나 설정합니다.

네임스페이스: System.Globalization
어셈블리: mscorlib(mscorlib.dll)

구문

‘선언
Public Property ShortTimePattern As String
‘사용 방법
Dim instance As DateTimeFormatInfo
Dim value As String

value = instance.ShortTimePattern

instance.ShortTimePattern = value
public string ShortTimePattern { get; set; }
public:
property String^ ShortTimePattern {
    String^ get ();
    void set (String^ value);
}
/** @property */
public String get_ShortTimePattern ()

/** @property */
public void set_ShortTimePattern (String value)
public function get ShortTimePattern () : String

public function set ShortTimePattern (value : String)

속성 값

't' 형식 문자와 관련된 간단한 시간 값의 형식 패턴입니다.

예외

예외 형식 조건

ArgumentNullException

속성이 Null 참조(Visual Basic의 경우 Nothing)로 설정되는 경우

InvalidOperationException

속성이 설정되어 있으며 DateTimeFormatInfo는 읽기 전용인 경우

설명

조합하여 "HH:mm"과 같은 사용자 지정 패턴을 만들 수 있는 패턴에 대해서는 DateTimeFormatInfo를 참조하십시오.

예제

다음 코드 예제에서는 몇 가지 culture에 대한 ShortTimePattern 값을 표시합니다.

Imports System
Imports System.Globalization

Public Class SamplesDTFI

   Public Shared Sub Main()

      ' Displays the values of the pattern properties.
      Console.WriteLine(" CULTURE    PROPERTY VALUE")
      PrintPattern("en-US")
      PrintPattern("ja-JP")
      PrintPattern("fr-FR")

   End Sub 'Main

   Public Shared Sub PrintPattern(myCulture As [String])

      Dim myDTFI As DateTimeFormatInfo = New CultureInfo(myCulture, False).DateTimeFormat
      Console.WriteLine("  {0}     {1}", myCulture, myDTFI.ShortTimePattern)

   End Sub 'PrintPattern 

End Class 'SamplesDTFI

'This code produces the following output.
'
' CULTURE    PROPERTY VALUE
'  en-US     h:mm tt
'  ja-JP     H:mm
'  fr-FR     HH:mm
'
using System;
using System.Globalization;


public class SamplesDTFI  {

   public static void Main()  {

      // Displays the values of the pattern properties.
      Console.WriteLine( " CULTURE    PROPERTY VALUE" );
      PrintPattern( "en-US" );
      PrintPattern( "ja-JP" );
      PrintPattern( "fr-FR" );

   }

   public static void PrintPattern( String myCulture )  {

      DateTimeFormatInfo myDTFI = new CultureInfo( myCulture, false ).DateTimeFormat;
      Console.WriteLine( "  {0}     {1}", myCulture, myDTFI.ShortTimePattern );

   }

}

/*
This code produces the following output.

 CULTURE    PROPERTY VALUE
  en-US     h:mm tt
  ja-JP     H:mm
  fr-FR     HH:mm

*/
using namespace System;
using namespace System::Globalization;
void PrintPattern( String^ myCulture )
{
   CultureInfo^ MyCI = gcnew CultureInfo( myCulture,false );
   DateTimeFormatInfo^ myDTFI = MyCI->DateTimeFormat;
   Console::WriteLine( " {0} {1}", myCulture, myDTFI->ShortTimePattern );
}

int main()
{
   
   // Displays the values of the pattern properties.
   Console::WriteLine( " CULTURE    PROPERTY VALUE" );
   PrintPattern( "en-US" );
   PrintPattern( "ja-JP" );
   PrintPattern( "fr-FR" );
}

/*
This code produces the following output.

CULTURE    PROPERTY VALUE
en-US     h:mm tt
ja-JP     H:mm
fr-FR     HH:mm

*/
import System.* ;
import System.Globalization.* ;

public class SamplesDTFI
{  
    public static void main(String[] args)
    {            
        // Displays the values of the pattern properties.
        Console.WriteLine(" CULTURE    PROPERTY VALUE");
        PrintPattern("en-US");
        PrintPattern("ja-JP");
        PrintPattern("fr-FR");
    } //main

    public static void PrintPattern(String myCulture)
    {
        DateTimeFormatInfo myDTFI = 
            (new CultureInfo(myCulture, false)).get_DateTimeFormat();

        Console.WriteLine("  {0}     {1}", 
            myCulture, myDTFI.get_ShortTimePattern());
    } //PrintPattern 
} //SamplesDTFI

/*
This code produces the following output.

 CULTURE    PROPERTY VALUE
  en-US     h:mm tt
  ja-JP     H:mm
  fr-FR     HH:mm
*/

플랫폼

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

.NET Compact Framework

2.0, 1.0에서 지원

참고 항목

참조

DateTimeFormatInfo 클래스
DateTimeFormatInfo 멤버
System.Globalization 네임스페이스