Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Hijiri (Arabic) date

Author  Topic 

shajimanjeri
Posting Yak Master

179 Posts

Posted - 2007-05-03 : 04:26:33

Hi,
Whether Hijiri (Arabic) date will accept by sql server??

What I mean is, In my table the datatype for date field is datetime. But I need to enter some Hijiri (Arabic calender) dates
like 01/11/1429 10:10:00 PM.

But its not accepting...Showing error datetime field overflow.

Is there anyway to add this?

Wiht regards
Shaji

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-05-03 : 04:42:18
use datetime parameters instead of string contencation and you'll be ok.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

shajimanjeri
Posting Yak Master

179 Posts

Posted - 2007-05-03 : 04:51:05

Thanks Mr.Spirit1,

Could you explain it for me, How to do this or a URL link where its explained. Please

Thanks

quote:
Originally posted by spirit1

use datetime parameters instead of string contencation and you'll be ok.

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp

Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-05-03 : 04:53:18
show us the code you're using

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

shajimanjeri
Posting Yak Master

179 Posts

Posted - 2007-05-03 : 05:05:52

I did the query like this

CID = replace(trim(request.form("Comp_ID")),"'","''")
TID = replace(trim(request.form("LType_ID")),"'","''")
ID = replace(trim(request.form("Issue_Date")),"'","''")
[This Issue_Date is Arabic date]

D = replace(trim(request.form("Duration")),"'","''")
ED = cint(d) * 12
EmpID = replace(trim(request.form("Emp_ID")),"'","''")
BN = replace(trim(request.form("Bank_Name")),"'","''")
A = replace(trim(request.form("Amount")),"'","''")
BID = replace(trim(request.form("Bank_Issue_Date")),"'","''")
[This Bank_Issue_Date is Arabic date]
BED = replace(trim(request.form("Bank_Expire_Date")),"'","''")
[This Bank_Expire_Date is Arabic date]
C = replace(trim(request.form("Comments")),"'","''")
sql = ("insert into License values('" & LN & "'," & CID & "," & TID & ",'" & ID & "'," & D & ",DATEADD(mm, " & ED & ",'" & ID & "')," & EmpID & ",N'" & BN & "'," & A & ",'" & BID & "','" & BED & "',N'" & C & "')")

With regards
Shaji



quote:
Originally posted by spirit1

show us the code you're using

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp

Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2007-05-03 : 05:10:23
read this:
http://weblogs.sqlteam.com/jeffs/archive/2006/07/21/10728.aspx

_______________________________________________
Causing trouble since 1980
blog: http://weblogs.sqlteam.com/mladenp
Go to Top of Page

chiragkhabaria
Master Smack Fu Yak Hacker

1907 Posts

Posted - 2007-05-03 : 05:17:11
we do the following things for accepting the hijri date.

1) We accept the date from the user in the Hijri format.

2) We convert the date format to the normal Geogorian date and then save them in the database. As our system is bilingual.


To Convert From Hijri to Geogorian, the query should be like this
SELECT CONVERT(datetime, '16/04/1428', 131)

To Convert from Geogorian to Hijri
SELECT CONVERT(nchar, GETDATE(), 131)



Chirag

http://chirikworld.blogspot.com/
Go to Top of Page
   

- Advertisement -