Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

مشکل تبدیل تاریخ شمسی به میلادی #62

Closed
hmahdi-s opened this issue Dec 22, 2018 · 13 comments
Closed

مشکل تبدیل تاریخ شمسی به میلادی #62

hmahdi-s opened this issue Dec 22, 2018 · 13 comments

Comments

@hmahdi-s
Copy link

برای تبدیل تاریخ شمسی به میلادی از متد
toGregorian
استفاده می کنم. منتهی ارور دریافت میکنم.

\Morilog\Jalali\CalendarUtils::toGregorian(1395,4,15)
اروری که دریافت می کنم:
htmlspecialchars() expects parameter ۱ to be string, array given
نسخه لاراولم ۵.۵ هست
نسخه پکیجی که نصب کردم :
3.*

@morilog
Copy link
Owner

morilog commented Dec 22, 2018 via email

@hmahdi-s
Copy link
Author

بله توی ویو

@hmahdi-s
Copy link
Author

به کاربر تاریخ شمسی رو نشون میدم. حالا میخوام وقتی ادیتش کرد مقدار ادیت شده رو به میلادی برگردونم و توی دیتابیس ذخیره کنم
سمپل دارید برای این روند؟

@hmahdi-s
Copy link
Author

jdtogregorian(1395, 2, 18)
error:
jdtogregorian() expects exactly 1 parameter, 3 given

@morilog
Copy link
Owner

morilog commented Dec 23, 2018

لطف کن داکیومنت رو بخون و از توابعی که گفته شده استفاده کن. اون تابعی که استفاده کردی کارش تبدیل تاریخ توی سطح پایین‌تره و یه جوری دیپندسی برای کلاس اصلیه.

@d-fal
Copy link

d-fal commented Jan 26, 2019

This code fails in runtime:

$Jalalian = "1394/1/2";
$dateTime = \Morilog\Jalali\CalendarUtils::createDatetimeFromFormat('Y/m/d', $Jalalian);

If one change it to
$Jalalian = "1394/01/02";
It goes fine.

Error:

Undefined index: year
vendor/morilog/jalali/src/CalendarUtils.php(756)

--- Reading the source code, it should be changed to

 $dateTime = \Morilog\Jalali\CalendarUtils::createDatetimeFromFormat('Y/n/j', $Jalalian);

I would suggest use a wrapper that works with 'Y/m/d' familiar paradigm. I can help with this.

@faridfr
Copy link

faridfr commented Feb 18, 2019

به کاربر تاریخ شمسی رو نشون میدم. حالا میخوام وقتی ادیتش کرد مقدار ادیت شده رو به میلادی برگردونم و توی دیتابیس ذخیره کنم
سمپل دارید برای این روند؟

@hmahdi-s
https://gist.github.com/faridfr/da19aed52452ec8e0c01ccc030d5fe85

@MRE-Developer
Copy link

(11ب.ظ29UTC292512UTC) سلام بنده که میخوام تبدیل کنم به شمسی تاریخ به هم میخوره و تبدیل میشه به
ممنون میشم راهنمایی کنید؟

@faridfr
Copy link

faridfr commented Mar 3, 2019

(11ب.ظ29UTC292512UTC) سلام بنده که میخوام تبدیل کنم به شمسی تاریخ به هم میخوره و تبدیل میشه به
ممنون میشم راهنمایی کنید؟

$jalali = jdate($miladi)->format('Y-m-d H:i:s')

@MRE-Developer
Copy link

@faridfr
ممنونم واقعا.عالی بود.
فقط مورد اول مشکلش چی بود که کار نمیکرد؟

@faridfr
Copy link

faridfr commented Mar 3, 2019

احتمالا فرمت خروجی رو مشخص نکردید . وقتی فرمت رو بصورت
Y-m-d H:i:s
مشخص کنید بصورت تاریخ و ساعت و اگر بصورت
H:i:s
مشخص کنید ، فقط ساعت رو نمایش میده

@MRE-Developer
Copy link

@faridfr
ممنونم

@morilog morilog closed this as completed Nov 5, 2020
@morilog morilog closed this as completed Nov 5, 2020
@MohammadBadzohreh
Copy link

سلام
میتونین jalalian::fromformat() استفاده کنین و اون پارامتر های مورد نیاز رو به تابع بدین

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants