0

I have a date stored as follows:

$user->password_expiry_dt

Carbon @1573228178 {#647 ▼
    date: 2019-11-08 15:49:38.0 UTC (+00:00)
}

I want to check if its expired without using the timestamp so currently i'm doing this:

Carbon::parse($user->password_expiry_dt)->hour(0)->minute(0)->second(0) <= Carbon::today()

Is there an easier or more elegant way to get the date without the timestamp as follows without having to chain all these extra setters?

2019-11-08 00:00:00.0 
adam78
  • 9,668
  • 24
  • 96
  • 207

1 Answers1

1

I think Carbon::parse($user->password_expiry_dt)->startOfDay() will do it for you

Pavel Lint
  • 3,252
  • 1
  • 18
  • 18