[ https://issues.apache.org/jira/browse/IGNITE-9951?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16658924#comment-16658924 ]
Stepan Pilschikov commented on IGNITE-9951: ------------------------------------------- [~alexey.kosenchuk] Yeah, looks not so pretty, but it really works, Thanks! {code} $cache->put((new Timestamp((DateTime::createFromFormat('Y-m-d H:i:s.u', '2018-10-22 13:35:19.117530'))->getTimestamp() * 1000 + 117, 117530)),1); {code} Nano seconds stay where they are and we just add millis For me all issues are fixed > thin php: Date data type cut nanos > ---------------------------------- > > Key: IGNITE-9951 > URL: https://issues.apache.org/jira/browse/IGNITE-9951 > Project: Ignite > Issue Type: Bug > Components: thin client > Affects Versions: 2.7 > Environment: Ignite 2.7 latest sources > default cache configuration > Python 3.7 > nodejs 10+ > PHP 7.2+ > Ubuntu 17 > Reporter: Stepan Pilschikov > Assignee: Pavel Petroshenko > Priority: Major > Fix For: 2.7 > > > When using PHP data types TIMESTAMP or DATE have problem with getting data > with others clients, main reason that is nano seconds was cutted from php > client side > PHP code > {code} > <?php > require_once '/vendor/autoload.php'; > use Apache\Ignite\Client; > use Apache\Ignite\ClientConfiguration; > use Apache\Ignite\Data\Date; > use Apache\Ignite\Type\ObjectType; > > $client = new Client(); > $ENDPOINT = '127.0.0.1:10800'; > $client->connect(new ClientConfiguration($ENDPOINT)); > $cache = $client->getOrCreateCache("PH_DATE") > ->setKeyType(ObjectType::INTEGER) > ->setValueType(ObjectType::DATE); > $cache->put(1,Date::fromDateTime(DateTime::createFromFormat('Y-m-d > H:i:s.u', '2018-10-19 18:31:13.029726'))); > {code} > JS output > {code} > "2018-10-19T15:31:13.000Z" > {code} > Py code > {code} > from pyignite import Client > from pyignite.datatypes import * > client = Client() > client.connect('127.0.0.1', 10800) > cache = client.get_or_create_cache("PH_DATE") > print(str(cache.get(1, key_hint=IntObject))) > {code} > Py output > {code} > 2018-10-19 18:31:13 > {code} > When im using JS or Python for put looks like > Py > {code} > 2018-10-19 18:31:13.029000 > {code} > JS > {code} > "2018-10-19T15:31:13.029Z" > {code} > Same story with Timestamp when > PHP put > {code} > <?php > require_once '/vendor/autoload.php'; > use Apache\Ignite\Client; > use Apache\Ignite\ClientConfiguration; > use Apache\Ignite\Data\Timestamp; > use Apache\Ignite\Type\ObjectType; > > $client = new Client(); > $ENDPOINT = '127.0.0.1:10800'; > $client->connect(new ClientConfiguration($ENDPOINT)); > try { > $cache = > $client->getOrCreateCache("PH_TIMESTAMP")->setKeyType(ObjectType::INTEGER)->setValueType(ObjectType::TIMESTAMP); > $cache->put(1,(new Timestamp((DateTime::createFromFormat('Y-m-d H:i:s.u', > '2018-10-19 18:31:13.029734'))->getTimestamp() * 1000, 29734))); > } finally { > $client->disconnect(); > } > {code} > Py output > {code} > (datetime.datetime(2018, 10, 19, 18, 31, 13), 29734) > {code} > should look like > {code} > (datetime.datetime(2018, 10, 19, 18, 31, 13, 29000), 29734) > {code} > Or JS > {code} > "2018-10-19T15:31:13.000Z" > {code} > should look like > {code} > "2018-10-19T15:31:13.029Z" > {code} > Also wanna to admit that PHP Method Timestamp::fromDateTime(Data) didn't take > nano seconds from date time (thats why in timestamp initialization i am doing > what i do) -- This message was sent by Atlassian JIRA (v7.6.3#76005)