0

Display tag value in MM/dd/yyyy format

Hi

I have a tag with Date/Time information, I am logging it as I8 type. I am getting this information from Logix5000 using GSV instruction wallclock -> currentvalue. (Long INT)

Is it possible to display tag value (Not time stamp) in MM/dd/yyyy format?

11 replies

null
    • smason
    • 2 yrs ago
    • Reported - view

    Hi afzaal. ahmed ,

    We may be able to transform it through some scripting, but we would need to know what format the I8 is represented in. Is it an epoch time such as EpochSeconds or EpochMilliseconds?

    • afzaal_ahmed
    • 2 yrs ago
    • Reported - view

    Hi Steve Mason

    Its EpochMicroseconds 

      • smason
      • 2 yrs ago
      • Reported - view

      afzaal. ahmed 

      Could you send us an example of one of the values in the epoch format and what you expect that to be transformed into? It would be helpful if you had an example before and after daylight savings time.

    • afzaal_ahmed
    • 2 yrs ago
    • Reported - view

    Steve Mason

    You want example as PLC logic(logix5000 file) or screen shot?

      • smason
      • 2 yrs ago
      • Reported - view

      afzaal. ahmed 

      A screenshot would be fine. We just want to make sure what the tag value looks like and what you would want it to look like after the transformation.

    • afzaal_ahmed
    • 2 yrs ago
    • Reported - view

     Steve Mason

    Here 1649635200000000 = 04/11/2022 April 11,2022

    and 1649721600000000 = 04/12/2022

    I am OK with both formats

    MM/dd/yyyy   04/11/2022

    and dd-MMM-yyyy    11-Apr-2022

    I know how to extract # of days from epochmicroseconds, but I don't know to represent date in above format.

    Because I am not concerned with time so daylight saving details do not matter. 

    In attachment I added Logix5000 Add on Instruction that converts  epochmicroseconds to equivalent date. If you cannot open logic I will send screen shots. 

      

    • afzaal_ahmed
    • 2 yrs ago
    • Reported - view

    Apparently deleting following line fixed the issue

    .ToLocalTime()
      • smason
      • 2 yrs ago
      • Reported - view

      afzaal. ahmed 

      Glad you could get it to work!

    • afzaal_ahmed
    • 2 yrs ago
    • Reported - view

    Thanks for your help Steve Mason

Content aside

print this pagePrint this page
  • 2 yrs agoLast active
  • 11Replies
  • 100Views
  • 2 Following