ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

To Convert Numeric field to Date/Time format

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • To Convert Numeric field to Date/Time format

    Hi,

    I need to conmvert a numeric field to Date field.

    A numeric(P 8 0) to Date (YYYY-MM-DD) format.

    Also a numeric(P 6 0) to Time (hh.mm.ss) format.

    Any way to achive this in Free Format?

    Thanks in advance,

    Harry

  • #2
    Re: To Convert Numeric field to Date/Time format

    Let me Google that for you ...
    Greg Craill: "Life's hard - Get a helmet !!"

    Comment


    • #3
      Re: To Convert Numeric field to Date/Time format

      and as gregs results from above my favorite is



      jamie
      All my answers were extracted from the "Big Dummy's Guide to the As400"
      and I take no responsibility for any of them.

      www.code400.com

      Comment


      • #4
        Re: To Convert Numeric field to Date/Time format

        Because Jamie and gcrail seem grumpy (and you're new to the forums) here ya go:

        PHP Code:
         D myDate          S               D                   
         D myDate8P0       S              8P 0 Inz
        (20080428)   
         
        D myTime          S               T                   
         D myTime6P0       S              6P 0 Inz
        (031922)     
           /
        free
            myDate 
        = %date(myDate8P0:*ISO);                       
            
        myTime = %time(myTime6P0:*ISO); 
            *
        INLR = *ON;                                          
           /
        end-free 
        There's a ton of conversion that you can do with %date and %time BIFs. Experiment with them when you get the chance. I find I don't often need too many other funky bits of code when it comes to dates/times.

        Comment

        Working...
        X