-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Issue in subMonth() method #37
Copy link
Copy link
Closed
Description
Hi Guys,
First of all, thanks for such great date plugin.
Today, I am trying Carbon to subtract month from today and got the below result. Here, on subtract month from july 30th, I am getting 1st of same month. Please let me know whether I am doing any wrong.
Code:
$dt = Carbon::now('Asia/Calcutta');
echo "Current Month:::".$dt;
$current_month_in_number = $dt->month;
$current_month_in_string = $dt->format('F');
$current_year_in_string = $dt->format('Y');
$last_month = $dt->subMonth();
echo "last_month:::".$last_month;
$prev_month = $dt->subMonth();
echo "prev_month:::".$prev_month;
Output:
Current Month:::2013-08-31 09:51:37
last_month:::2013-07-31 09:51:37
prev_month:::2013-07-01 09:51:37
Thanks in advance.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels