From ca40c1f4eede0de12230a997bb4b0e5021054874 Mon Sep 17 00:00:00 2001 From: Shamim Rezaie Date: Mon, 22 Jan 2018 18:47:06 +1100 Subject: [PATCH] MDL-61027 calendar: Fix datetime profile field issue with non-Gregorian --- user/profile/field/datetime/field.class.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/user/profile/field/datetime/field.class.php b/user/profile/field/datetime/field.class.php index acdfe573635..bb58a6fc1a5 100644 --- a/user/profile/field/datetime/field.class.php +++ b/user/profile/field/datetime/field.class.php @@ -81,7 +81,8 @@ class profile_field_datetime extends profile_field_base { } if (is_numeric($datetime)) { - $datetime = userdate($datetime, '%Y-%m-%d-%H-%M-%S'); + $gregoriancalendar = \core_calendar\type_factory::get_calendar_instance('gregorian'); + $datetime = $gregoriancalendar->timestamp_to_date_string($datetime, '%Y-%m-%d-%H-%M-%S', 99, true, true); } $datetime = explode('-', $datetime);