| - WMI Fun !! -|WMI Step|WMI Sample|WMI Reference|WMI LibraryLinks|About WMI Fun !! |
|
|
|
|
Home > WMI Sample > 第x四半期を取得する
|
|
第x四半期を取得する: Win32_LocalTime
■Topics
現在第x四半期であるか取得するサンプルです。Win32_LocalTimeクラスを使用します。
Private Sub Command1_Click()
Dim LtSet As SWbemObjectSet Dim Lt As SWbemObject Dim Locator As SWbemLocator Dim Service As SWbemServices Dim Ret As String Set Locator = New WbemScripting.SWbemLocator Set Service = Locator.ConnectServer Set LtSet = Service.ExecQuery("Select * From Win32_LocalTime") For Each Lt In LtSet Ret = "今日は、" & Lt.Month & "月" & Lt.Day & "日です。" & _ "第" & Lt.Quarter & "四半期です。" Next MsgBox Ret Set LtSet = Nothing Set Lt = Nothing Set Service = Nothing Set Locator = Nothing End Sub
実行すると今日の日にちと、現在の四半期を表示します。Win32_LocalTimeにはQuarterプロパティが用意されている為、簡単に取得が可能です。
|
|
ご意見・ご感想をこちらのアンケートからお待ちしています
解らないIT/パソコン用語は - WMI Fun !! - http://www.wmifun.net/ Microsoft社のテクノロジーであるWMI(Windows Management Instrumentation)の使い方を Visual Basicを使ってのんびり公開しています VBや.Net Framework(VB,C#)以外でもWSH(VBS)やPowerShellなどのスクリプトでも使えますよ! 資産管理や監視業務の効率化、システム系ツール開発にお勧めです This web site created by Toh. Copyright(C) 1997-2010 WMI Fun !!. All rights reserved. このサイトへのリンクはフリーです |
| ∧ ページの先頭へ… |