E
E
Eugene2018-06-27 11:03:04
PHP
Eugene, 2018-06-27 11:03:04

How to work with date in Unicode format?

I work with the bank's API, and there the date / time comes in Unicode format:
$authDateTime = 1530083933281
I rummaged through everything, I just can't figure out how to process this string. Or is it just a timeStamp with some kind of timezone?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
DarkByte2015, 2018-06-27
@DarkByte2015

1. Correct Unicode e - it hurts your eyes
2. It's not clear what kind of Unicode we are talking about. It seems that this is a regular timestamp, but extra numbers have been added to the right. Most likely there is an error somewhere: either in yours or in the service API. You can try to simply cut them off (substr).

A
Anton, 2018-06-27
@Eridani

$authDateTime = 1530083933281;
echo date('d-m-Y H:i:s', time($authDateTime + (60 * 60)));

27-06-2018 08:13:25

P
profesor08, 2018-06-27
@profesor08

The last three digits are milliseconds, date does not understand them, so you need to cut them off.
echo date('d-m-Y H:i:s', $authDateTime / 3);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question