hi,
how can i make mathematical operations with the DateTime format from thw Sql? -- this is the format 9/6/2007 11:09:00 PM --
how can i substract 30 days from that date and know the resulting one?
if i have two dates, how can i know what number of hours and minutes are between them (if they are fewer than 24), or what number of days and hours and minutes are (if the difference is grater than 24 hours)
please help me, thanks
You can use the sql function DATEADD. To perform subtraction, you simply pass a negative value to DATEADD.
http://msdn2.microsoft.com/en-us/library/ms186724.aspx
For the difference between two dates, you can use DATEDIFF. To express that difference in day,hours etc.. you can get some ideas from here:
http://classicasp.aspfaq.com/date-time-routines-manipulation/how-do-i-convert-a-datediff-to-days-hours-and-minutes.html
|||
thank you, very good examples
No comments:
Post a Comment