Changes for page 2 Script

Last modified by Devin Chen on 2025/12/10 10:32

From version 3.1
edited by Devin Chen
on 2025/09/05 11:51
Change comment: There is no comment for this version
To version 1.1
edited by Wecon
on 2025/09/03 21:04
Change comment: Imported from XAR

Summary

Details

Page properties
Author
... ... @@ -1,1 +1,1 @@
1 -XWiki.DevinChen
1 +XWiki.Wecon
Content
... ... @@ -560,58 +560,6 @@
560 560  end
561 561  {{/code}}
562 562  
563 -== **1.12 Get UTC timestamp and local timezone timestamp** ==
564 -
565 -This demo shows how to obtain UTC standard time from the V-Box and get the local time based on the device's time zone.
566 -
567 -**Register configuration**
568 -
569 -[[image:1757043722849-910.png]]
570 -
571 -**Script configuration**
572 -
573 -(% style="text-align:center" %)
574 -[[image:1757043900216-610.png||height="412" width="439"]]
575 -
576 -
577 -**Script**
578 -
579 -
580 -
581 -{{code language="lua"}}
582 -function time.main()
583 -
584 - --Get Coordinated Universal Time
585 - local timestamp = os.time()
586 - local utcTimeTable = os.date("!*t", timestamp)
587 - local utcTimestamp = os.time(utcTimeTable)
588 - local formattedTime = os.date("%Y-%m-%d %H:%M:%S", utcTimestamp)
589 -
590 - print("UTC: " ..formattedTime)
591 -
592 - --Calculate the local time at the device's location
593 - local utc_7Timestamp = os.time(utcTimeTable) + 25200 -- Enter the corresponding number of seconds based on the time difference,used UTC+7 as an example..
594 - local formattedTime1 = os.date("%Y-%m-%d %H:%M:%S", utc_7Timestamp)
595 - print("UTC+7: " .. formattedTime1)
596 -
597 -
598 - --Assign the decomposed timestamp to the specified register
599 - addr_setword("@UTC+7_Second",os.date("%S", utc_7Timestamp))
600 - addr_setword("@UTC+7_Minute",os.date("%M", utc_7Timestamp))
601 - addr_setword("@UTC+7_Hour",os.date("%H", utc_7Timestamp))
602 - addr_setword("@UTC+7_Day",os.date("%d", utc_7Timestamp))
603 - addr_setword("@UTC+7_Month",os.date("%m", utc_7Timestamp))
604 - addr_setword("@UTC+7_Year",os.date("%Y", utc_7Timestamp))
605 - print("--------------------------------------")
606 -
607 -end
608 -{{/code}}
609 -
610 -**Result**
611 -
612 -(% style="text-align:center" %)
613 -[[image:1757044137457-543.png||height="468" width="708"]]
614 -
615 615  = **2 Third part server** =
616 616  
617 617  V-Box have two mode.One is for V-Net,User need to use WECON server to store data.We call this V-NET platform.
1757043722849-910.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.DevinChen
Size
... ... @@ -1,1 +1,0 @@
1 -74.4 KB
Content
1757043900216-610.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.DevinChen
Size
... ... @@ -1,1 +1,0 @@
1 -62.9 KB
Content
1757044137457-543.png
Author
... ... @@ -1,1 +1,0 @@
1 -XWiki.DevinChen
Size
... ... @@ -1,1 +1,0 @@
1 -99.4 KB
Content