nuliknol
27th January 2015, 18:43
Hi,
I have problems converting from timestamp to QDateTime. This is the code:
QDateTime somedate=QDateTime::fromMSecsSinceEpoch(1000*14220 21168);
QDate some_d=somedate.date();
qWarning() << "some_d=" << some_d.toString();
and this is what I get on the console:
some_d= "Mon Jan 5 1970"
The date I used is of 23 Jan of this year, as you can see below
-bash-3.00$ cat /tmp/test.php
<?
$ts=1422021168;
echo date("Y-m-d H:i",$ts);
?>
-bash-3.00$ /usr/bin/php -f /tmp/test.php
2015-01-23 07:52
-bash-3.00$
What I am missing?
TIA
I have problems converting from timestamp to QDateTime. This is the code:
QDateTime somedate=QDateTime::fromMSecsSinceEpoch(1000*14220 21168);
QDate some_d=somedate.date();
qWarning() << "some_d=" << some_d.toString();
and this is what I get on the console:
some_d= "Mon Jan 5 1970"
The date I used is of 23 Jan of this year, as you can see below
-bash-3.00$ cat /tmp/test.php
<?
$ts=1422021168;
echo date("Y-m-d H:i",$ts);
?>
-bash-3.00$ /usr/bin/php -f /tmp/test.php
2015-01-23 07:52
-bash-3.00$
What I am missing?
TIA