DIR Return Create A Forum - Home --------------------------------------------------------- mc-Things HTML https://mcthings.createaforum.com --------------------------------------------------------- ***************************************************** DIR Return to: mc-Studio ***************************************************** #Post#: 1967-------------------------------------------------- Timestamps By: GarnetTozer Date: May 15, 2017, 8:44 pm --------------------------------------------------------- Is anyone having much luck with the time functions? Specifically I want to return the current hour from modul . Secondly, when I read this value, the format (converted to string) appears as such: 2017-05-16T00:59:59+00:00 My PC clock is reading that same date, but the time is 7:42 pm. Hours, minutes, and seconds seem to be a bit off. None the less, I still want to fetch the hours integer value. Garnet #Post#: 1979-------------------------------------------------- Re: Timestamps By: Nick_W Date: May 20, 2017, 1:36 pm --------------------------------------------------------- Checkout my Time library, everything i know about timestamps is in it. BTW the module time is really the gateway time (obtained from NTP server), and sent to the module when it connects. Timezone doesn't really seem to work though... #Post#: 1988-------------------------------------------------- Re: Timestamps By: GarnetTozer Date: May 21, 2017, 9:34 am --------------------------------------------------------- Thanks Nick, I've just google'd you and am checking it out now. Garnet #Post#: 2061-------------------------------------------------- Re: Timestamps By: bdevlin Date: July 9, 2017, 1:08 pm --------------------------------------------------------- I can't seem to get datetime.now() until the second request from a module. It kinda makes sense I guess, but that means the modules first response is bad data. #Post#: 2063-------------------------------------------------- Re: Timestamps By: mc-John Date: July 10, 2017, 11:17 am --------------------------------------------------------- The code to get date/time info looks like this: [code] Dim dat As DateTime = DateTime.Now Dim hr As Integer = dat.Hour Dim sec As Integer = dat.Second Dim month As Integer = dat.Month [/code] #Post#: 2065-------------------------------------------------- Re: Timestamps By: bdevlin Date: July 12, 2017, 2:53 pm --------------------------------------------------------- I can get data from DateTime.Now() but The data transmitted via publish in the first module boot is "2000-01-01T00:00:00+00:00", then the second and subsequent publish the time nearly correctly, however it's off by an hour (-8:00N is my time zone). I can't figure out how to force the module to fetch the time fist in the boot() event successfully first. This seems to work ok, any problems with this method? Shared Event Boot() While DateTime.Now().Year= 2000 End While End Event #Post#: 2068-------------------------------------------------- Re: Timestamps By: mc-John Date: July 17, 2017, 9:21 am --------------------------------------------------------- That will work. To limit power consumption you could sleep for 100mSec in the while loop. #Post#: 2070-------------------------------------------------- Re: Timestamps By: bdevlin Date: July 17, 2017, 1:35 pm --------------------------------------------------------- So that would be this in uSeconds? While DateTime.Now().Year= 2000 Thread.Sleep(100000) End While #Post#: 2071-------------------------------------------------- Re: Timestamps By: mc-John Date: July 18, 2017, 9:56 am --------------------------------------------------------- That's correct *****************************************************