Loading ...
Sorry, an error occurred while loading the content.

1305The ISO-8601 duration “PYMDTHMS ” was a stroke of genius.

Expand Messages
  • hjwoudenberg@aol.com
    Jul 7, 2005
    • 0 Attachment

       

      I believe it can be used to standardize functions, for example the finding the difference of two dates.

       

      I have made a function:

       

      Difference = function ( ‘2005-06-05’ : ‘2004-04-04’  : prototype)

       

      Prototype = ‘PYMD’           Difference = ‘P1Y2M1D’

      Prototype = ‘PD’                 Difference = “P427D’

      Prototype = ‘PYD’              Difference = ‘P1Y62D’

      Prototype = ‘PYMTH’        Difference = ‘P1Y2MT24H’

      Prototype = ‘PMD’             Difference = ‘P14M1D’

       

      Actually, the function has more features.

       

      Difference = function ( ‘2005-06-05T20:50:50’ : ‘.FR’  : ‘2004-06-05T08:45:47’ : ‘.US.IL’ : prototype)

      Difference = ‘PT5H5M3S’

      If the same time and date used in both it gives ‘-PT7H’ of if I reverse them ‘PT7H’

      It converts both times to UTC time and than takes the difference.  The code is the ISO 3166 country code.  

       

      The change function works as follows

      To-date  = function (‘.FR’ ; ‘2005-06-05T08:45:00 ; ‘.US.IL’ :  ‘PT5H. )

      To-date = ‘2005-06-05T21:45:00+02:00’  this time in France 5 hours from now from that time.

      If the time is blank, it gets the computer UTC time. for ‘.US.IL' and than adds 5 hours and gives the time in France 5 hours from now.  If the ‘.US.IL’ is blank it goes my local area. 

       

      hjw