我正在使用 Laravel。我將此行添加到控制器中$remarks = Remarks::where('document_id', $document->id)->orderBy('created_at', 'DESC)->get();或者$remarks = Remarks::where('document_id', $document->id)->latest('created_at')->get();我習慣于foreach獲取每一條評論。這些是結果$remark->$description2019年11月10日 - 上午8:292019年10月10日 - 下午2:49 2019年10月10日 - 下午3:572020年9月13日 - 下午2:06 2020年9月13日 - 下午2:08它應該是2020年9月13日 - 下午2:082020年9月13日 - 下午2:062019年11月10日 - 上午8:29 2019年10月10日 - 下午3:572019年10月10日 - 下午2:49另外,即使當我將 ASC 或 DESC 更改orderBy為 ASC 或 DESC 時,它也不會影響視圖中的任何內容,它總是顯示此2019年11月10日 - 上午8:292019年10月10日 - 下午2:49 2019年10月10日 - 下午3:572020年9月13日 - 下午2:06 2020年9月13日 - 下午2:08
為什么使用order by或latest對時間戳進行排序只能按日期排序而不是按時間排序?
慕田峪9158850
2024-01-19 16:57:38