From 070ed72f744e1eba2b7741f2092b2c7275864b94 Mon Sep 17 00:00:00 2001 From: okaeiz <100111649+okaeiz@users.noreply.github.com> Date: Thu, 2 Mar 2023 12:38:23 +0330 Subject: [PATCH] Function structure for `NUM_EN2FA` This function can show Jalali datetime in Persian digits. --- persian_date_functions.sql | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/persian_date_functions.sql b/persian_date_functions.sql index 821a2f5..a269a2b 100644 --- a/persian_date_functions.sql +++ b/persian_date_functions.sql @@ -15,6 +15,32 @@ -- along with this program. If not, see . -- Pathed by Amir Mirmoeini (Added read-only + deterministic flags to prevent errors in new and strict MySql or MariaDB environments) +-- ---------------------------- +-- This library belongs to Mohammad Saleh Souzanchi but the function below is written by @okaeiz +-- Function structure for `NUM_EN2FA` +-- ---------------------------- + +CREATE DEFINER=`root`@`localhost` FUNCTION `NUM_EN2FA`(`strdate` CHAR ( 10 )) RETURNS char(10) CHARSET utf8 + READS SQL DATA + DETERMINISTIC +BEGIN +# Copyright (C) 2009-2022 Mohammad Saleh Souzanchi +# WebLog : https://soozanchi.ir +# Version V3.0.0 + + SET strdate = REPLACE ( strdate, '1', '۱' ); + SET strdate = REPLACE ( strdate, '2', '۲' ); + SET strdate = REPLACE ( strdate, '3', '۳' ); + SET strdate = REPLACE ( strdate, '4', '۴' ); + SET strdate = REPLACE ( strdate, '5', '۵' ); + SET strdate = REPLACE ( strdate, '6', '۶' ); + SET strdate = REPLACE ( strdate, '7', '۷' ); + SET strdate = REPLACE ( strdate, '8', '۸' ); + SET strdate = REPLACE ( strdate, '9', '۹' ); + SET strdate = REPLACE ( strdate, '0', '۰' ); + RETURN strdate; +END + -- ---------------------------- -- Function structure for `NUM_FA2EN`