#61908 closed defect (bug) (invalid)
wp_date does not support micro seconds.
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Priority: | normal | |
| Severity: | normal | Version: | 6.6 |
| Component: | Date/Time | Keywords: | |
| Focuses: | Cc: |
Description (last modified by )
// This fails because of this line.
$date = wp_date('Y-m-d H:i:s.u',microtime( true ));
if ( null === $timestamp ) {
$timestamp = time();
} elseif ( ! is_numeric( $timestamp ) ) {
return false;
}
// Should be changed to this.
if ( null === $timestamp ) {
$timestamp = time();
} elseif ( ! is_numeric( $timestamp ) || ! is_float($timestamp) {
return false;
}
Attachments (1)
Change History (4)
Note: See
TracTickets for help on using
tickets.
Hi @dpeterson1971
You are very welcome to the Core Trac!
I have tried this and it is working fine, please let me know if I am missing anything.
Please find the code I am using.
$date = wp_date('Y-m-d H:i:s.u',microtime( true )); var_dump( $date );