Example Code

Set System Time using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

This example shows how to set Windows system time using LabVIEW and the kernal32.dll.

 

Description

This code set the Windows system time using LabVIEW and the kernal32.dll.  Make sure to right click on LabVIEW and Run as Administrator before using the program.

 

Requirements

  • LabVIEW 2012(or compatible)

 

Steps to Implement or Execute Code

  1. Run the vi.

 

Additional Information or References

Front Panel

FP.JPG

VI Snippet

BD.png

**This document has been updated to meet the current required format for the NI Code Exchange.**

Applications Engineer
National Instruments

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
sankar06
Member
Member
on

i have tried this vi in different PC's and different OS. But it is not working. let me know i missed anything.

Happy to Wire
Ajay_MV
Active Participant
Active Participant
on

The setsystemtime.vi and Set System Time 2012 NIVerified.vi sets the time in UTC format.  It might look like the setting is not working properly if you try this VI from different time-zones.  There is another function from MSDN Kernel for SetLocalTime.  I have attached a VI Set System Date Time (UTC & Local Time).vi which does both UTC and Local Time setting.

 

PS: VI is in LV2014 version.

--
Ajay MV