Gives you the possibility to seamlessly wrok (Store, Retrieve, Calculate and Perform Operations) with Persian Dates in Microsoft SQL Server !
Handling and Converting Georgian dates to Jalali back and forth is a nightmare for those who need to store/retrieve Jalali dates in their Database applications !
Common solutions are converting Dates back and forth and/or saving them as plain text but neither of these methods gives you the possibility to perform operations on the Persian dates solely using Transact SQL queries !
PersianDate and PersianDateTime Types
Using this tiny piece of code adds two new types to you MsSQL Database : "PersianDate" and "PersianDateTime" which can be used to store and retrieve Persian Date/Time !
Example Usage :
Here's a simple example : (Creating a table with column types of PersianDate and/or PersianTime)
CREATE TABLE [dbo].[Main](
[ID] [uniqueidentifier] NOT NULL,
[LoginDate] [dbo].[PersianDate] NULL,
[LogoutDateTime] [dbo].[PersianDateTime] NULL
INSERT INTO Main (ID, Date, DateTime)
VALUES (NEWID(), CONVERT(PersianDate, '1387/8/21'), dbo.PersianDateTime::CreateDateTime(1368,06,31,10,44,28))
And a good looking T-SQL to select certain Persian Date/DateTimes :
SELECT LoginDate.ToString(), LoginDate.DayOfWeek
WHERE (LoginDate.DayOfMonth = 31 AND LoginDate.Year = 1368) OR LoginDate.DayOfWeekName = N'یکشنبه'
There are many more properties that you can evaluate and a handful of mthods to manipulate and/or convert Persian Date/DateTimes.
I'm looking forward for your feedback / feature requests ! feel free to write a review and/or leave comments !
You can also contact me directly on Twitter : @dNetGuru