Skip to content

strtotime($month) not returning the correct timestamp #18955

Closed as not planned
Closed as not planned
@allentcm

Description

@allentcm

Description

The following code:

date('n', strtotime('February')) // run on 27 Jun 2025
date('n', strtotime('February')) // run on 30 May 2025
<?php

Resulted in this output:

"2"
"3"

But I expected this output instead:

"2"
"2"

https://drive.google.com/file/d/1C_TqQZ95fKGdpqg2dTUv-Xdso6XFZAHY/view?usp=sharing
https://drive.google.com/file/d/1a5GIHG72hVxyawOSy-in2PuKA43NGOb8/view?usp=sharing
https://drive.google.com/file/d/1rFtocAqIY34WUgxlBlJ7HPbzyN3uL3bT/view?usp=sharing

PHP Version

PHP 8.3.19 (cli) (built: Apr  8 2025 03:57:19) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.19, Copyright (c) Zend Technologies
    with Zend OPcache v8.3.19, Copyright (c), by Zend Technologies

Operating System

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions