how to move date into one single tag

yakub

Member
Join Date
Nov 2012
Location
hyderabad
Posts
28
i am using RS logix 5000 programming software for compact logix..i want to send date(ex:23-may-2013) into one single TAG(integer type)..i am not able to do this.if u knw plz suggest
 
You can't combine integer and string into a single data type, but if you use months in integer format, minus the hyphens you may try it using BTD instruction

Regards
 
The way most old computer languages did it was to encode the date as the number of days since January 1, 0001. You can call it a 'Rata Die' or 'proleptic Gregorgian date' if you want to sound fancy.

But just doing a sanity check says that 2013 x 364.25 = 735,248 days. So you can't encode that in even an unsigned 16-bit integer.

So you will have to use a 32 bit double integer, or do a different sort of encoding that doesn't adhere to a standard. My first instinct would be to use the count of days from the start of the Unix Epoch on January 1, 1970.

The calculation of the 'day of the year', also called the 'ordinal day' or 'Julian day', has been discussed on the Forum in the past. You can search this Forum, or go to the Rockwell Automation Sample Code website and search for 'julian' to find a structured text routine that calculates the ordinal day of the year.
 
We have used what we (likely incorrectly call) the "julian date" where the last digit of the year is the first digit and the days of the year are the remaining 3 digits, i.e. today is 3149 ( 149 days into 2013)
Its obviously only good for 10 years at a time and that works for what we use it for. You could of course use the last 2 digits of the year (i.e. 13149) for the next 20+ years as an INT type, then you need to think of something else ;).
 
One simply way would be to encode today as 20130528. You will have to use a DINT instead of an integer, but after you use GSV to get your wall clock time multiply the year by 10,000, and multiply the month by 100. Then add year, month, and day together.

There are lots of date examples on the forum. Try searching wallclocktime or GSV. Somewhere around here I posted an ordinal date program and a Julian date program. A search will probably turn it up. Use the forum search function link found at the top of this page on the blue-green colored bar.
 
Last edited:

Similar Topics

Hi folks. First time I've tried to do this. I am using rs5K V.28 and change, FTV ME V.8.0. I have a project that entails moving values into...
Replies
4
Views
1,781
Hi everyone, I am working with micro850, a proximity sensor (FOTEK, PL-05P) and a 3DOF serial arm robot. I use MC_MoveRelative to control the...
Replies
1
Views
57
So I'm pretty green when it comes to troubleshooting in the field so bear with me. We have a Danfoss valve that opens/closes from an analog output...
Replies
23
Views
953
Hi. This is pretty basic but I'm struggling to find an efficient solution. I have a float value of let say 666.555 that I want to move / split...
Replies
3
Views
207
hi, I got a plc S7-1200 with SEW movitrac **** and i need to program something ridiculous if my application reaches sensor 1 then my SEW has to...
Replies
0
Views
188
Back
Top Bottom