OB Get on Time Field

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

OB Get on Time Field

4D Tech mailing list
I suppose I'm missing something obvious...

Within an object "created":"2014-02-01T09:28:56"

OB Get is returning the correct date with:

OB Get($OBGenInfo;"created";Is date) with

But, time always returns ?00:00:02? using:

OB Get($OBGenInfo;"created";Is time)
 
Or is the time a count down 'till an IPA or maybe steamer lager?

--
   ------------------------------------------------------------------
   Tom Dillon                                           825 N. 500 W.
   DataCraft                                           Moab, UT 84532
   [hidden email]                           720/209-6502
   ------------------------------------------------------------------
     Life is a great big canvas; throw all the paint you can at it.
      --- Danny Kaye
   ------------------------------------------------------------------


**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: OB Get on Time Field

4D Tech mailing list
the same question was posted on the forums a couple of days ago.
time values are represented in milliseconds,
so a date string, the first part of which is the year 2017,
approximates to 2 seconds past midnight.

> 2017/05/25 8:32、Tom Dillon via 4D_Tech <[hidden email]> のメール:
>
> OB Get($OBGenInfo;"created";Is date) with
> But, time always returns ?00:00:02? using:
> OB Get($OBGenInfo;"created";Is time)
> Or is the time a count down 'till an IPA or maybe steamer lager?



**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: OB Get on Time Field

4D Tech mailing list
OB Get is simply doing the reverse of OB SET, which sets milliseconds for time.

If you want to convert an ISO GMT timestamp to 4D local date or time you can use the Date and Time commands, which were upgraded in v14:

$timestamp:="2017-05-25T23:00:00.294Z"  //next day in Japan

$date:=Date($timestamp)  //returns the local date
$time:=Time($timestamp)  //returns the local time

---

alternatively...

C_TIME($time)
XML DECODE($timestamp;$time)  //returns the local time

$param85:=Get database parameter(JSON use local time)
SET DATABASE PARAMETER(JSON use local time;1)

$date:=JSON Parse(Char(Double quote)+$timestamp+Char(Double quote);Is date) //returns the local date

SET DATABASE PARAMETER(JSON use local time;$param85)



**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************
Reply | Threaded
Open this post in threaded view
|

Re: OB Get on Time Field

4D Tech mailing list
In reply to this post by 4D Tech mailing list
> I suppose I'm missing something obvious...
>
> Within an object "created":"2014-02-01T09:28:56"
>
> OB Get is returning the correct date with:
>
> OB Get($OBGenInfo;"created";Is date) with
>
> But, time always returns ?00:00:02? using:
>
> OB Get($OBGenInfo;"created";Is time)
>
> Or is the time a count down 'till an IPA or maybe steamer lager?

I was wondering about that unexpected behaviour when parsing a JSON-feed
<http://dddd.mettre.de/wp/json-feed/?inug>

Suppose the library 4D uses to parse JSON is less flexible, than the formatting of date/time as JSON-object is. Helped myself and cut the time out of the received text-representation.


Grüße/regards
Ortwin Zillgen
**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: http://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:[hidden email]
**********************************************************************