{"id":22313544,"url":"https://github.com/mirsaeedi/sqlclr-jalali-date-utility","last_synced_at":"2025-07-29T10:32:33.959Z","repository":{"id":148847222,"uuid":"68894935","full_name":"mirsaeedi/SQLCLR-Jalali-Date-Utility","owner":"mirsaeedi","description":"Includes several functions to make it easier for you to work with Persian dates in SQL Server (2005+)","archived":false,"fork":false,"pushed_at":"2021-01-19T15:10:40.000Z","size":42,"stargazers_count":24,"open_issues_count":1,"forks_count":9,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-05-11T14:44:16.974Z","etag":null,"topics":["calendar","gregorian","jalali","jalali-calendar","jalalidate","shamsi","sql","sql-clr","sql-server","sqlcmd-mode"],"latest_commit_sha":null,"homepage":"","language":"TSQL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mirsaeedi.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2016-09-22T07:15:43.000Z","updated_at":"2025-04-08T07:01:22.000Z","dependencies_parsed_at":"2023-07-06T10:46:22.703Z","dependency_job_id":null,"html_url":"https://github.com/mirsaeedi/SQLCLR-Jalali-Date-Utility","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mirsaeedi/SQLCLR-Jalali-Date-Utility","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirsaeedi%2FSQLCLR-Jalali-Date-Utility","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirsaeedi%2FSQLCLR-Jalali-Date-Utility/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirsaeedi%2FSQLCLR-Jalali-Date-Utility/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirsaeedi%2FSQLCLR-Jalali-Date-Utility/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mirsaeedi","download_url":"https://codeload.github.com/mirsaeedi/SQLCLR-Jalali-Date-Utility/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mirsaeedi%2FSQLCLR-Jalali-Date-Utility/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":267670325,"owners_count":24125130,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-07-29T02:00:12.549Z","response_time":2574,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["calendar","gregorian","jalali","jalali-calendar","jalalidate","shamsi","sql","sql-clr","sql-server","sqlcmd-mode"],"created_at":"2024-12-03T22:07:30.148Z","updated_at":"2025-07-29T10:32:33.550Z","avatar_url":"https://github.com/mirsaeedi.png","language":"TSQL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SQL CLR Jalali Date Time Utility\n\nThe aim of this project is to make it more easier for developers to work with jalali (shamsi - شمسی) dates.\n\n* Support .Net Date and Time Formatting (More Information at this page: [Custom Date and Time Format Strings](https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx) ).\n* Developed with C# (SQL CLR)\n\n ## 💡 Installation\n\n* Make sure you have .NET framework 4.7.2+ installed on your server.\n\n* Since this library has beed developed using SQL CLR, firstly you need to configure your SQL Server by [Enabling CLR Integration In SQL Server](https://msdn.microsoft.com/en-us/library/ms131048.aspx)\n\n### SQL Server 2005-2014\n```sql\nsp_configure 'show advanced options', 1;  \nGO  \nRECONFIGURE;  \nGO  \nsp_configure 'clr enabled', 1;  \nGO\nRECONFIGURE;  \nGO  \n```\n### SQL Server 2017+\n```sql\nsp_configure 'show advanced options', 1;  \nGO  \nRECONFIGURE;  \nGO  \nsp_configure 'clr enabled', 1;  \nGO\nEXEC sp_configure 'clr strict security',0;\nGO\nRECONFIGURE;  \nGO  \n```\n\n* Run the [Deployment Script](https://github.com/mirsaeedi/SQLCLR-Jalali-Date-Utility/blob/master/SqlCLR.JalaliDateUtility/Dist/DeploymentScript.sql) in SQL Server Management Studio to generate the Jalali functions in your database. \n\n* Note that you have to run this script in SQLCMD Mode. So in SQL Management Studio, Select _Query Menu_, and then select _SQLCMD Mode_. Now you will be able to execute the query.\n\n* Please be sure that you have changed the _[your-database-name]_ inside the [Deployment Script](https://github.com/mirsaeedi/SQLCLR-Jalali-Date-Utility/blob/master/SqlCLR.JalaliDateUtility/Dist/DeploymentScript.sql) to your database's name.\n\n\n## 🕹 Usage\n\n###### ★ Convert Gregorian To Jalali:\n\nSuppose that GETDATE() Method in sql server returns 2016/09/22 15:04:33\n\n```sql\nselect dbo.GregorianToJalali(GETDATE(),'yy') -- returns 95\n```\n\n```sql\nselect dbo.GregorianToJalali(GETDATE(),'yyyy') -- returns 1395\n```\n\n```sql\nselect dbo.GregorianToJalali(GETDATE(),'yyyy-MM') -- returns 1395-07\n```\n\n```sql\nselect dbo.GregorianToJalali(GETDATE(),'yyyy-M') -- returns 1395-7\n```\n\n```sql\nselect dbo.GregorianToJalali(GETDATE(),'yyyy/MM/dd') -- returns 1395/07/01\n```\n\n```sql\nselect dbo.GregorianToJalali(GETDATE(),'yyyy/MM/dd hh:mm tt') -- returns 1395/07/01 03:04 ب ظ\n```\n\n```sql\nselect dbo.GregorianToJalali(GETDATE(),'yyyy/MM/dd hh:mm:ss tt') -- returns 1395/07/01 03:04:33 ب ظ\n```\n\n```sql\nselect dbo.GregorianToJalali(GETDATE(),'yyyy/MM/dd HH:mm') -- returns 1395/07/01 15:04\n```\n\n```sql\nselect dbo.GregorianToJalali(GETDATE(),'yyyy MMMM dddd') -- returns 1395 پنج شنبه مهر\n```\n\n\n###### ★ Convert Jajali Date To Gregorian:\n\n```sql\nselect dbo.JalaliToGregorian('95-06-11','-') --returns 2016-09-01 00:00:00.000\n```\n\n```sql\nselect dbo.JalaliToGregorian('1395/06/11','/') --returns 2016-09-01 00:00:00.000\n```\n\n###### ★ Some times you need to have the first and last day of a persian month in gregorian date (specially in reporting)\n\n```sql\nselect dbo.GetJalaliLastDayOfMonth(GETDATE()) --returns 2016-10-21 00:00:00.000 which is equal to 1395/07/30\n```\n\n```sql\nselect dbo.GetJalaliFirstDayOfMonth(GETDATE()) --returns 2016-09-22 00:00:00.000 which is equal to 1395/07/01\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmirsaeedi%2Fsqlclr-jalali-date-utility","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmirsaeedi%2Fsqlclr-jalali-date-utility","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmirsaeedi%2Fsqlclr-jalali-date-utility/lists"}