Jump to content
Sign in to follow this  
lgvlgv

help with reaing time hour:min

Recommended Posts

lgvlgv

How to u get only "hour:min" from system and compare it with time=hour:min in a inifile?

ex.. time=18:00

I keep getting lost when it comes to time functions.

//Regards L

 

Share this post


Link to post
Share on other sites
water

@HOUR & ":" & @MIN


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
somdcomputerguy

The macros @HOUR & @MIN, as well as the functions IniRead & StringInStr could probably be used to accommodate you here.

edit: oh I'm a slow typer!

Edited by somdcomputerguy

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
lgvlgv

The macros @HOUR & @MIN, as well as the functions IniRead & StringInStr could probably be used to accommodate you here.

edit: oh I'm a slow typer!

i was thinking that but wasent sure when comparing they would be the same format or if one was just text and the other some date/time format?

Share this post


Link to post
Share on other sites
somdcomputerguy

Look at water's post (#2) to put the time macros and the : character in the desired format. The macros would be creating a string, and a string would be read from the file.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
water

As soon as you concatenate numbers with a character (":") the result is a string. IniRead returns a string too.

So no problem when comparing.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-01-27 - Version 1.3.3.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites
lgvlgv

If i vant to convert it, what do i do?  i would like to stop some services between lets say 03:00 and 07:00, the rest of the time its ok to run.

Share this post


Link to post
Share on other sites
kylomas

lgvlgv,

Convert what?  This will do something once every day between 03:00 and 07:00. 

local $flag = false     ; used to do action once

while 1

    if (@hour >= 03 and @hour <= 07) and $flag = false then
        $flag = true
        ;
        ; do your thing
        ;
    EndIf

    sleep(1000)

    if (@hour < 03 or @hour > 07) and $flag then $flag = not $flag

wend

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×