Skip to content

date() function went long #1729

Closed
Closed

Description

@toproplus

Affected Page URL

https://www.php.net/manual/zh/function.date.php

Describe the bug

Today is 2025-12-31, PHP version is 8.2.28

echo date('Y-m', strtotime('-1 month')); // The result is "2025-11"

Steps to reproduce

Today is 2025-12-31, PHP version is 8.2.28

echo date('Y-m', strtotime('-1 month')); // The result is "2025-11"

Expected behavior

Today is 2025-12-31, PHP version is 8.2.28

echo date('Y-m', strtotime('-1 month')); // The result is "2025-11"

Screenshots

No response

Additional context

No response

Activity

  1. sy-records commented on Jan 6, 2026

    @sy-records
    Member

    strtotime is not reliable on the 29th, 30th, or 31st of a month.

    https://www.laruence.com/2018/07/31/3207.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions