سلام من این کد رو نوشتم .. ببین کارت رو راه میندازه یا نه
در ضمن مارو مطلع کن( اینکه درست کار میکنه یا نه)
CREATE proc GetTodayDate AS
begin
declare @YR int, @DY int
SET @YR = Year(GetDate())
SET @DY = DATEDIFF(day, CAST(Year(GetDate())AS Char(4) )+'-01-01',Getdate() )
SELECT dbo.GetHijriDate(@YR,@DY +1)
end
GO
--------------------------------------------------------------------------------------------------------
CREATE Function GetHijriDate(@YR int,@DY int) Returns char(10) AS
Begin
Declare @monthDays char(36),@KabiseDayes char(36),@monthNames char(39)
declare @s int,@days int,@i int, @Base int
declare @Sal char(4),@mah char(2),@roz char(2)
SET @monthDays=',30,30,29,31,31,31,31,31,31,30,30,30'
SET @KabiseDayes=',30,30,30,31,31,31,31,31,31,30,30,30 '
SET @monthNames=',10,11,12,01,02,03,04,05,06,07,08,09, 10'
SET @Base = 10
SET @S= @YR-622
IF @YR % 4 = 1 SET @Base= @Base +1
IF @S % 4 = 3 SET @monthDays= @KabiseDayes
SET @Days= @DY+@Base
Set @i=1
While @i<=12
begin
IF @Days <= Cast(SUBSTRING(@monthDays, 3*@i-1, 2) as int) break;
SET @Days =@Days-Cast(SUBSTRING(@monthDays, 3*@i-1, 2) as int);
SET @i =@i +1
end
SET @mah = SUBSTRING(@monthNames, 3*@i-1, 2)
SET @roz = Cast( @Days as char(2) )
IF LEN(@roz)=1 SET @roz ='0'+ @roz
IF @i >3 SET @S=@s+1
SET @sal = Cast(@s as char(4))
Return @sal+'/'+@mah+'/'+@roz
End
GO