V
V
Viktor Familyevich2017-09-21 11:49:27
css
Viktor Familyevich, 2017-09-21 11:49:27

How to convert date to uniqid()?

There is a code that returns a date with microseconds. How can I convert it to the hexadecimal format that uniqid() returns?

function udate($format = 'u', $utimestamp = null) {
        if (is_null($utimestamp))
            $utimestamp = microtime(true);

        $timestamp = floor($utimestamp);
        $milliseconds = round(($utimestamp - $timestamp) * 1000000);

        return date(preg_replace('`(?<!\\\\)u`', $milliseconds, $format), $timestamp);
    }

echo udate('Y-m-d H:i:s.u');

Answer the question

In order to leave comments, you need to log in

3 answer(s)
I
Ilya Derevyannykh, 2019-06-08
@Ylia_dr

I left it as it was, the php code that generates the footer, replaced it with html wherever it was and added it to style="color: white !important;"

A
Alex Karo, 2019-06-06
@Zraza

The problem is in this piece of code.

..., .footer-menu-links li>a:hover, .archive-title, tbody a, p a, dl dd a, ... {
    color: #000 !important;
}

It's better not to use !important - it's problematic to override such styles.
In this case, you need to exclude .footer-menu-links li>a from the specified styles. Or remove important and set a different text color for .site-info
I also advise you to read about specificity - https://habr.com/en/post/436610/
To catch such things, I advise you to use Chrome Developer Tools, you can see what styles act on specified element

F
Fortop, 2017-09-21
@Wintego

php.net/manual/en/function.dechex.php
Converts any decimal number to hexadecimal.
Well, you should be able to turn the date into a timestamp

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question