Jump to content

Recommended Posts

Posted (edited)

Folks,

Looking at the helpfile in relation to _Date_Time_GetTimeZoneInformation() gives me a headache.

The first element of the returned array is specified as:

0 - Daylight savings time is not used in the current time zone

1 - Daylight savings time operating with standard time

2 - Daylight savings time operating with daylight savings time

I understand:

'0 - Daylight savings time is not used in the current time zone' and

'2 - Daylight savings time operating with daylight savings time'

but what is 'Daylight savings time operating with standard time'? How can you have daylight savings time with no change to the local time or am I misinterpreting the explanation? I'm really tired so I assume that is the actual answer.

Blah... meant to post this in the General help and support forum.

Edited by 4Eyes
  • 1 year later...
Posted (edited)

Func _TimeConvert_GetDaylightSavingTime($__iShow)
    ;    Please don't remove this line - © Copyright 2013: J. Malmgren, wwww.tryware.dk
    ;    Get SystemTime, convert it with Daylight saving time (DST), and convert it according to $__iShow
    ;    Return result:        Syntax:
    ;    YYYYMMDD HH:MM:SS    $__iShow =1
    ;    YYYYMMDD            $__iShow =2
    ;    HH:MM:SS            $__iShow =3
    ;    HHMMSS                $__iShow =4
    ;
    ;    Examples:
    ;
    ;    MsgBox(0,"YYYYMMDD HH:MM:SS",_TimeConvert_GetDaylightSavingTime(1))
    ;    MsgBox(0,"YYYYMMDD",_TimeConvert_GetDaylightSavingTime(2))
    ;    MsgBox(0,"HH:MM:SS",_TimeConvert_GetDaylightSavingTime(3))
    ;    MsgBox(0,"HHMMSS",_TimeConvert_GetDaylightSavingTime(4))
    ;    MsgBox(0,"ERROR:",_TimeConvert_GetDaylightSavingTime(5))

    Local $__sGetSystemTime = _Date_Time_GetSystemTime()
    Local $__sGetDstTime  = _Date_Time_SystemTimeToTzSpecificLocalTime(DllStructGetPtr($__sGetSystemTime))
    Local $__iGetTime = _Date_Time_SystemTimeToDateTimeStr($__sGetDstTime)

    Local $__sTime                    ;    1234567890123456789
                                    ;    12/31/2013 23:23:22

    Switch $__iShow
        Case 1                        ;    YYYYMMDD HH:MM:SS
            $__sTime = StringMid($__iGetTime, 7, 4) & ":" & StringMid($__iGetTime, 1, 2) & ":" & StringMid($__iGetTime, 4, 2)
            $__sTime = $__sTime  & " " & StringMid($__iGetTime, 12, 3) & StringMid($__iGetTime, 15, 3) & StringMid($__iGetTime, 18, 2)

        Case 2                        ;    YYYYMMDD
            $__sTime = Int(StringMid($__iGetTime, 7, 4) & StringMid($__iGetTime, 1, 2) & StringMid($__iGetTime, 4, 2))

        Case 3                        ;    HH:MM:SS
            $__sTime = StringMid($__iGetTime, 12, 3) & StringMid($__iGetTime, 15, 3) & StringMid($__iGetTime, 18, 2)

        Case 4                        ;    HHMMSS
            $__sTime = Int(StringMid($__iGetTime, 12, 2) & StringMid($__iGetTime, 15, 2) & StringMid($__iGetTime, 18, 2))

        Case Else
            $__sTime = "SYNTAX ERROR: _TimeGetDaylightSavingTime = 1, 2, 3 or 4"
    EndSwitch

    Return $__sTime
EndFunc

Edited by Melba23
Added code tags

Sincerely

J. Malmgren

IT-Programmer

http://www.tryware.dk

 

  • Moderators
Posted (edited)

nergmlam,

When you post code please use Code tags - see here how to do it. Then you get a scrolling box and syntax colouring as you can see above now I have added the tags. ;)

M23

Edit: And I see you have posted this same function in several posts - I have deleted all the other instances. Next time just add it to the "Examples" section and please do not multi-post like that again! :naughty:

Edited by Melba23
Typo

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

  Reveal hidden contents

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...