2440588 = days from Jan 1, 4713 BC to Jan 1, 1970

So it would be something like

convert (varchar(10),dateadd(day, Invoicemonth-2440587, '1 January
1970'), 101) 'Invoice Month 1'


________________________________

From: Action Request System discussion list(ARSList)
[mailto:[EMAIL PROTECTED] On Behalf Of Moore, Christopher Allen
Sent: Thursday, April 10, 2008 5:01 PM
To: arslist@ARSLIST.ORG
Subject: Re: date field and SQL


** 

 

So is there a way to convert 2454436 to dd/mm/yyyy?

 

 

________________________________

From: Action Request System discussion list(ARSList)
[mailto:[EMAIL PROTECTED] On Behalf Of Grooms, Frederick W
Sent: Thursday, April 10, 2008 4:59 PM
To: arslist@ARSLIST.ORG
Subject: Re: date field and SQL

 

Date fields are not stored in seconds (You are thinking of DateTime or
Time fields).  Date fields are stored as the number of days since
January 1, 4713 B.C.

 

________________________________

From: Action Request System discussion list(ARSList)
[mailto:[EMAIL PROTECTED] On Behalf Of Moore, Christopher Allen
Sent: Thursday, April 10, 2008 4:44 PM
To: arslist@ARSLIST.ORG
Subject: date field and SQL

Hey everyone,


I added a date field to a form and when we are trying to get the value
out in SQL we're not getting what we expect.  If I just do a select of
the field, I get a 7 digit number (2454436).  If I try and run the same
conversion against it that is run against the date/time fields:

 

convert (varchar(10),dateadd(second, Invoicemonth, '1 January 1970'),
101) 'Invoice Month 1'

 

we get 1/28/1970.  I'm no SQL expert- how can I get the value of that
field in a MM/DD/YYYY format?

 

Thanks!

Chris

 

 

__Platinum Sponsor: www.rmsportal.com ARSlist: "Where the Answers Are"
html___ __Platinum Sponsor: www.rmsportal.com ARSlist: "Where the
Answers Are" html___

_______________________________________________________________________________
UNSUBSCRIBE or access ARSlist Archives at www.arslist.org
Platinum Sponsor: www.rmsportal.com ARSlist: "Where the Answers Are"

Reply via email to