Announcement

Collapse
No announcement yet.

Foreign country time stuff

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Scott Turchin
    replied
    Well got an answer, so if anyone is interested in specifying the EXACT return string you want, regardless of country, go here:

    This one is for date format http://msdn.microsoft.com/library/de...e/nls_5w6s.asp

    This one is for time format: http://msdn.microsoft.com/library/de...e/nls_6at0.asp

    ------------------
    Scott

    Leave a comment:


  • Scott Turchin
    replied
    I should also mention the other functions, that might help:
    This is a piece that writes the log file:
    Code:
        sTmp = Format$(lCount + 1) & "ø" & GetPCDate(%DATE_LONGDATE,tzInfo)& "ø" & GetPCTime(%TIME_NOSECONDS,tzInfo) & "ø" & wUser & "ø" & CCSGetComputerName
        Replace "," With "ø" In sTmp
        lCrcCount = lCRCRegistry + CRC32&(sTmp) 'Write one line update in registry
        g_sClipText = g_sClipText + sTmp + "|" 'Pipe will represent chr$(13,10), it does not fail encryption
    
    And this piece is the date/time stuff
    '------------------------------------------------------------------------------------------
    
    Function GetPCTime(TimeFormat As Long,tzInfo As TIME_ZONE_INFORMATION) Export As String
    Local sTime        As SYSTEMTIME
    Local tTime             As Asciiz * 64
    '%TIME_NOMINUTESORSECONDS 1
    '%TIME_NOTIMEMARKER 2
    '%TIME_FORCE24HOURFORMAT 3
    If TimeFormat = 0 Then TimeFormat =  %TIME_NOSECONDS
    GetLocalTime sTime
    'GetTimeFormat %LOCALE_USER_DEFAULT,TimeFormat,sTime, ByVal %NULL, tTime, 64
    GetTimeFormat %LOCALE_SYSTEM_DEFAULT,TimeFormat,sTime, ByVal %NULL, tTime, 64
    GetTimeZoneInformation tzInfo
    Function = tTime
    End Function
    '-----------------------------------------------------------------------------------
    Function GetPCDate(DateFormat As Long,tzInfo As TIME_ZONE_INFORMATION) Export As String
    Local sTime        As SYSTEMTIME
    Local tDay              As Asciiz * 64
    
    If DateFormat = 0 Then DateFormat =  %DATE_LONGDATE
    GetLocalTime sTime
    
    'GetDateFormat %LOCALE_USER_DEFAULT,DateFormat, sTime, ByVal %NULL, tDay, 64
    GetDateFormat %LOCALE_SYSTEM_DEFAULT,DateFormat, sTime, ByVal %NULL, tDay, 64
    GetTimeZoneInformation tzInfo
    Function = tDay
    End Function
    '-----------------------------------------------------------------------------------
    ------------------
    Scott

    Leave a comment:


  • Scott Turchin
    started a topic Foreign country time stuff

    Foreign country time stuff

    I have an issue, seems so petty but the cure does not.

    Normally my app logs this stuff, and the delimeters are for parsing inbetween the "|" symbol, which is also parsed..
    Works great in America...

    In germany is another story:

    America:
    1øFridayø July 06ø 2001ø1:36 PMøtngbbsøTNG2K|

    Germany:
    '1øFreitagø 6. Juli 2001ø21:57øAdministratorøMACHINENAME|2øFreitagø 6. Juli2001ø21:57øAdministratorøMACHINENAME|

    SO my parser looks like this, but how can I modify it to suite everyone?
    If the dates are stored so random I'd have to create a parser for each country

    Code:
        For lLoop = 1 To g_lTotalReboot
            LVArray(lLoop) = Parse$(g_sClipText,"|",lLoop)
            lCrcCount =  lCrcCount + CRC32&(LVArray(lLoop))
        Next
    
        'Currently the LVArray holds all data, nicely formatted,
        'g_sClipText needs this formatting to match the order (reverse or forward)
        g_sClipText = "" 'Update in loops
    
        If g_lRevOrderFlag = 1 Then GoTo ReverseOrder
        For lLoop = 1 To g_lTotalReboot
            g_sClipText = g_sClipText + LVArray(lLoop) + $CRLF
            'Sample
            '1 Friday July 6, 2001 8:51 AM,tngbbsTNG2K|
            '1*Freitag* 6. Juli 2001*21:57*Administrator*WORK-BLU170|2*Freitag* 6. Juli2001*21:57*Administrator*WORK-BLU170|
            g_sRec(0) = Parse$(LVArray(lLoop),"ø", 1)
            g_sRec(1) = Parse$(LVArray(lLoop),"ø", 2)
            g_sRec(2) = Parse$(LVArray(lLoop),"ø", 3)
            g_sRec(3) = Parse$(LVArray(lLoop),"ø",4)   'July 6, 2001
            g_sRec(4) = Parse$(LVArray(lLoop),"ø",5)
            g_sRec(5) = Parse$(LVArray(lLoop),"ø",6)
            g_sRec(6) = Parse$(LVArray(lLoop),"ø",7)
            AppendListView g_hListView 'Append to the ListView
        Next
    ------------------
    Scott
Working...
X