Request for date conversion in ACL

Discussion of Common Lisp
Post Reply
dekda
Posts: 1
Joined: Fri Sep 05, 2014 4:23 am

Request for date conversion in ACL

Post by dekda » Fri Sep 05, 2014 4:34 am

Hi everyone
I am using ACL to write a simple rule to compare the date from the knowledge base(KB) with the current time...
The date of format in KB is in this format 19:00:00+08:00 but however when i called the triples in ACL it return in this format 280515645427456.However i convert this using lisp UPI which return in this format -59958190799137. I also found a problem when tried to compare this with the current time as it return universal format 3618891473.I hope you can help to solve the problem.This is the sample rule that i wrote ...hope you guys can help me

Code: Select all

  (<-- (FindAction ?mac ?tnow ?tnow1 ?t1 ?tt1 ?action ?graph) 
       (q ?dataS !DS:hasMacAddress ?mac ?graph)
       (q ?dataS !DS:hasLuminance ?LumX ?graph)
       (lisp ?tnow (get-universal-time))
       ;(lisp ?tnow1 (upi->value ?tnow))
       ;(lisp ?timX (date-string-to-upi ?tnow))
        (q ?cc !IOT:hasParameter ?ccp)
       (not (q ?ccp !IOT:hasMotion ?Mot))
       (q ?ccp !IOT:hasLuminance ?Lum)
       (q ?Lum !IOT:hasMinLum ?Lum1)
       (lispp (<= (upi->value ?Lum1) (upi->value ?LumX)))
       (q ?Lum !IOT:hasMaxLum ?Lum2)
       (lispp (<= (upi->value ?LumX) (upi->value ?Lum2)))
       (q ?ccp !IOT:hasTime ?time)
       (q ?time !IOT:hasMinTime ?t1)
       (lisp ?tt1 (upi->value ?t1))
       ;(lisp ?tt2 (ut-to-date-time ?tt1))
       (lisp (<= ?t1 ?tnow))
       ;(lispp (<= ?tt1 ?tnow)) 
       (q ?time !IOT:hasMaxTime ?t2)
       ;(lisp ?tt2 (upi->value ?t2))
        (lisp (<= ?tnow ?t2))
       ;(lispp (<= ?tnow ?tt2))
       
       (q ?ccp !IOT:hasAction ?action)
      )
Last edited by nuntius on Fri Sep 05, 2014 6:29 am, edited 1 time in total.
Reason: added [code] tags

logxor
Posts: 20
Joined: Tue May 27, 2014 10:56 am
Location: Portland, OR

Re: Request for date conversion in ACL

Post by logxor » Fri Sep 05, 2014 2:16 pm

I don't know what these numbers mean or what functions you're using to convert between them, but I'm guessing you'll need to have all dates and times in ISO 8601 format—not universal-time format, or anything else—in order to compare them.

Akira22

Re: Request for date conversion in ACL

Post by Akira22 » Mon Sep 15, 2014 3:45 am

BTW I'm new in ACL, want to know about the find function & the specif function, which can be used to Returns a field value from a record that is a specified number of records from the current record... Thanks in advance

Post Reply