Skip to content

Function Valid::date for timestamp #705

@mati1986

Description

@mati1986

I noticed recently that the function Valid::date has stopped working for timestamp.

	/**
	 * Tests if a string is a valid date string.
	 *
	 * @param   string  $str    date to check
	 * @return  boolean
	 */
	public static function date($str)
	{
		return (strtotime($str) !== FALSE);
	}

Example:

$str = 1499385600; // 07/07/2017
var_dump(strtotime($str) !== FALSE); // false
$str = 1500422400; // 07/19/2017
var_dump(strtotime($str) !== FALSE); // true

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