Store Date/Time in SQL Server 2005

S

shahoo

Hi, I know this is not a good place for this post, but I have too.
I need to store Hijri Date in SQL Server 2005, but because it is year
1386 in Hijri calendar, SQL Server does not let me do that. I can
store it as simple text but it is not a good approach.
Can anyone help me please?
 
A

Ashot Geodakov

What do you mean by "SQL Server does not let me do that"?

Can't you just execute the following statement,

insert into whatever_table( whatever_date_field ) values( cast( '01/01/1386'
as datetime ) )

?
 
M

mpetrotta

shahoo said:
Hi, I know this is not a good place for this post, but I have too.
I need to store Hijri Date in SQL Server 2005, but because it is year
1386 in Hijri calendar, SQL Server does not let me do that. I can
store it as simple text but it is not a good approach.
Can anyone help me please?

You're really, *really* going to have better luck asking the question
on a SQL Server newsgroup.
Try any of the groups in the microsoft.public.sqlserver hierarchy.

Michael
 
M

mpetrotta

What do you mean by "SQL Server does not let me do that"?

Can't you just execute the following statement,

insert into whatever_table( whatever_date_field ) values( cast( '01/01/1386'
as datetime ) )

?

Nope. The range of SQL Server's datetime datatype is January 1, 1753,
through December 31, 9999. (1753 was the year the Gregorian calendar
was widely adopted).

Michael
 
S

shahoo

You're really, *really* going to have better luck asking the question
on a SQL Server newsgroup.
Try any of the groups in the microsoft.public.sqlserver hierarchy.

Michael

OK I will. Thanks for the help.
 
M

Marc Gravell

Just a thought; store it in what the db (and indeed, .NET etc) is
happy with (i.e. Gregorian), but translate it at the presentation tier
through different validation / formatting.

At the end of the day, in the database it is only a number (well, set
of bytes of you take it too literally) - it only represents (say) a
Gregorian vs Hijri date/time value when you add context.

Marc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top