Akif KC

Current Date and Time

10 posts in this topic

Hi Guys,

Can someone please tell me how I can obtain the current date and time to my program in Omron? In AB we can use the GSV instruction and obtain it, but not familiar with Omron. Can someone please help. Thanks you very much.

Share this post


Link to post
Share on other sites

Please provide the model number of the processor you are using.

Instructions may be different depending on your hardware.

Share this post


Link to post
Share on other sites

Oh, it is NJ101-9000. Thank you very much.

Share this post


Link to post
Share on other sites

Looks like it would be the GetTime instruction (see attached).

 

NJ_GetTime.jpg

Share this post


Link to post
Share on other sites

Hi,

I tried as you told and I got the Time and date as I need. But what I am looking for is to extract the current time so I can create a production sheet every hour. I am getting a variable of Date and Time data type, but I am not getting the time itself. Can you  please help. Thanks.

Share this post


Link to post
Share on other sites

Review the DT_TO_TOD instruction.

Share this post


Link to post
Share on other sites

Thank you very much. Now just one more please, how can I extract the Hour Min and Sec from that separately??? Please assist. Thank you very much.

Share this post


Link to post
Share on other sites

If you got the variable, you got the data.

If you set the clock, you can read it with GetTime or look at the contents of the _CurrentTime variable which is built in.

Make sure to set the clock from the Controller menu when online, and set your time zone.

If you want to see each part as a separate variable, consider DtToDateStruct which will break each part out to its own variable.

Share this post


Link to post
Share on other sites

Wow, Thank you very much. Awesome.  That was easier than I thought.

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