"English", "dir" => "ltr", /-6ren">
gpt4 book ai didi

php - 在 Laravel 中将日期和时间转换为 Jalali

转载 作者:可可西里 更新时间:2023-11-01 12:54:10 32 4
gpt4 key购买 nike

我想将时间和日期日历更改为 Jalali (伊朗使用的 Shamsi 日历)在我的系统中。我该怎么做?

	"language_title" => "English",
"dir" => "ltr", // ltr = left to right, rtl = right to left
"language_code" => "en",
"intl_locale" => "en_US",
"dec_point" => ".",
"thousands_sep" => ",",
"dateformat_full" => "D, M j Y g:i A", // http://php.net/manual/en/function.date.php
"dateformat_date_long" => "D, M j Y", // http://php.net/manual/en/function.date.php
"intl_dateformat_full" => "E, d MMM yy h:m a", // http://userguide.icu-project.org/formatparse/datetime
"intl_dateformat_date_long" => "E, d MMMM yyyy", // http://userguide.icu-project.org/formatparse/datetime

最佳答案

您可以使用 Jalali/Morilog .

将 Jalali 日期转换为格鲁吉亚碳日期:

$jalaliDate = "1399/08/06";
$georgianCarbonDate=\Morilog\Jalali\Jalalian::fromFormat('Y/m/d', $jalaliDate)->toCarbon();

并将格鲁吉亚碳纪年转换为贾拉利纪年:

$jalaliDate=\Morilog\Jalali\Jalalian::fromCarbon($carbonDate)->format('Y/m/d'); // output is a jalali date string like 1399/08/06

关于php - 在 Laravel 中将日期和时间转换为 Jalali,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30377948/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com