Click here to Skip to main content
15,905,508 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
In storedprocedures only

I got an int datatype which will be converted into datetime then i will add it at a datetime datatype anyone know how to do it?

This is the Logic

CAST(NUMBEROFDAYS AS DATE)
EXPIRYDAY = NUMBEROFDAYS + DATETODAY

-I dont have google :)
Posted
Updated 2-Feb-14 13:47pm
v3
Comments
Karthik_Mahalingam 30-Jan-14 4:49am    
post your code..
pls add more info..

1 solution

We can't answer that: it depends on what value you have in your integer: is it a number of days since a point in time, and what point, SQL time ticks, or what.

So get Google, or Bing if you must, and start looking.
We are not here to do your research for you.
 
Share this answer
 
Comments
Goenitz 2-Feb-14 19:42pm    
Im sorry original grif, i think you misread the whole question as i have said i dont have google, well it contains number of days, as for my sites I only have codeproject as my reference site all others are blocked
OriginalGriff 3-Feb-14 4:54am    
That's just stupid - how are you supposed to do your job without online searches, particularly in a world where the manual for everything is only available online? Complain and explain that you need it!
Anyway - you don;t want to convert the number to a DATE - SQL includes a function to add a number of days to an existing date, so do this:
DATEADD(dd, NUMBEROFDAYS, GETDATE())
It adds the number of days to the current date and returns a DATETIME value.
I don't know if you can get here:
http://www.w3schools.com/sql/func_dateadd.asp
but if you can it's a good reference for SQL.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900