Re: WBEM time in VB.NET WQL SelectQuery

From: Dmitry (Dmitry_at_discussions.microsoft.com)
Date: 07/14/04

  • Next message: Philip Nunn [MSFT]: "Re: see below"
    Date: Wed, 14 Jul 2004 09:23:02 -0700
    
    

    Well, I do string manipulations now, but it is very strange, that this functionality is present in VBScript, and it's absent in .NET...
    I still would like to figure out now to convert this type within .NET native functionality and not converting date to string and re-compiling it for WQL. I tried to contact out MS account, and all they could recommend is to call Premier support ($1K call) which my management is not approving at the moment. I am reluctant to believe that I am the only one who needs to query event log from VB.NET with WMI/WQL here.
    I know that .NET having its own event log readers, but I can't compile query complex enough to target exact events in exact time. WMI seems to be "the tool" for this situation... anybody from Microsoft monitoring this post? Please comment.

    "Torgeir Bakken (MVP)" wrote:

    > Dmitry wrote:
    >
    > > Anybody? I know that somebody should know it!
    > > I am looking for VB.NET way of doing following:
    > >
    > > [VB Script]
    > > CONST CONVERT_TO_LOCAL_TIME = TRUE
    > > SET dtmStartDate = CreateObject("WbemScripting.SWbemDateTime")
    > > TIME_START = "12/12/2004"
    > > dtmStartDate.SetVarDate TIME_START, CONVERT_TO_LOCAL_TIME
    > > [EOF]
    > >
    > > Anybody? Please! I am reading event log with WQL and need to query
    > > certain events between 2 dates.
    > > It seems like WQL requiring following format for the date:
    > > Example: 20040629010540.000000-300
    > >
    > > How do I convert "06/29/2004 10:54 AM" to "20040629010540.000000-300"
    > > ????
    > Hi
    >
    > I would think VB.NET has some date functions as well as string
    > manipulation functions, so you can build the string yourself,
    > like the VBScript example in this post:
    >
    > http://groups.google.com/groups?threadm=3E8245FB.819F13D4%40hydro.com
    >
    >
    > --
    > torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
    > Administration scripting examples and an ONLINE version of
    > the 1328 page Scripting Guide:
    > http://www.microsoft.com/technet/community/scriptcenter/default.mspx
    >


  • Next message: Philip Nunn [MSFT]: "Re: see below"

    Relevant Pages

    • Re: date time conversiton
      ... VBScript cannot ... literal in VBScript if you cut off the fractions of a second. ... If you are reading the column value as a string, ... Microsoft MVP Scripting and ADSI ...
      (microsoft.public.scripting.vbscript)
    • Re: formating a date string in vbscript
      ... > in visual basic I can use the formatdate function and the formatting ... > is flexible enough to create this string. ... In vbscript the ... -- torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway Administration scripting examples and an ONLINE version of the 1328 page Scripting Guide: ...
      (microsoft.public.scripting.vbscript)
    • Re: date field as sql table key
      ... >>> Using VBscript. ... I would like to use a date field with the format ... Private Declare Sub GetLocalTime Lib "kernel32" (lpSystemTime As SYSTEMTIME) ... Public Function GetTimeAsString() As String ...
      (microsoft.public.vb.general.discussion)
    • Re: how these 2 functions may differ?
      ... I assume the vbscript chr and asc functions use the default codepage just like they do in the microsoft.visualbasic .net namespace. ... I was using the ASCIIEncoding.ASCII class to go from string to bytes and vice versa. ... So I changed my base64 functions to the following and all is well. ...
      (microsoft.public.dotnet.languages.csharp)
    • Re: VBScript, OpenTextFile(), Strings and Unicode - Possible?
      ... I can't even write the string back without modifications into the ... To VBScript the string doesn't seem ... Set stream = Nothing ... successfully because the name of the encoding is included in the file. ...
      (microsoft.public.scripting.vbscript)