Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 8th, 2007, 06:31 AM
Registered User
 
Join Date: May 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to convert date to days

Hello

Is it possible to convert date to days from 01-01-1900
to date = number of days in a SQL statment ???
 ex from 01-01-1900 to 01-01-1901 = 365 days

The format is dd-mm-yy
Regards ml



Reply With Quote
  #2 (permalink)  
Old May 8th, 2007, 06:38 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Do you define the start and end dates to calculate the number of days? If so
Code:
DECLARE @StartDate datetime, @EndDate datetime
SET @StartDate = '2007-01-01'
SET @EndDate = '2007-05-01'

SELECT DateDiff(d, @StartDate, @EndDate)
Which returns 120. Does this helps?

Cheers

_________________________
- Vijay G
Strive for Perfection
Reply With Quote
  #3 (permalink)  
Old May 8th, 2007, 06:49 AM
Registered User
 
Join Date: May 2007
Location: , , .
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks it was the DataDiff in SQL.
Du you know a link to find SQL statements Like DateDiff ??

Reply With Quote
  #4 (permalink)  
Old May 8th, 2007, 07:05 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Check Books online (BOL) for "Date Functions".

_________________________
- Vijay G
Strive for Perfection
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
date conversion in years, months and days naveed77 Beginning VB 6 0 January 2nd, 2008 01:18 AM
Todays date and date of 3 days later Singh591 Visual Basic 2005 Basics 1 December 21st, 2006 06:06 PM
How to calculate a number of days between 2 date windy417 Pro JSP 1 July 20th, 2006 07:09 PM
convert to days khautinh SQL Server 2000 4 September 8th, 2005 02:09 PM
Can't subtract days from a date Please Help Arsi C# 1 January 6th, 2005 03:34 PM



All times are GMT -4. The time now is 01:04 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.