In oracle database birthdate store as 01/01/47 but in asp.net i used dataset to fetch this record and i get the bithdate value as 01/01/2047
visiual studio 2008
oracle 11g

Recommended Answers

use a function to manipulate your actual date and to return desired result, and then retreive your query result through that function. That should work...

You can try this:

CREATE FUNCTION [dbo].[CorrectDate] (@bDate varchar(12))
RETURNS VARCHAR(12)
AS
BEGIN
	DECLARE @dt VARCHAR(12),
	@Yr	VARCHAR(4),
	@actualdt VARCHAR(12)

	SET …
Jump to Post

All 2 Replies

use a function to manipulate your actual date and to return desired result, and then retreive your query result through that function. That should work...

You can try this:

CREATE FUNCTION [dbo].[CorrectDate] (@bDate varchar(12))
RETURNS VARCHAR(12)
AS
BEGIN
	DECLARE @dt VARCHAR(12),
	@Yr	VARCHAR(4),
	@actualdt VARCHAR(12)

	SET @dt=@bDate
	SET @yr=SUBSTRING(@dt,7,4)
	IF LEN(@Yr)=2 
	BEGIN
		SET @yr='19'+@Yr
	END
	
	set @actualdt=SUBSTRING(@dt,1,6)+@Yr
		
	Return @actualdt
END
SELECT column1,column2,dbo.correctdate('01/01/47') as 'BirtDate' from tableName

:yawn:

ok thanks for reply, but now i got one reason that when the birthdate is <=50(50 is year) than it display as 2047 or something like that

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.