Hi,
I have a date field stored as an INT and need to convert to a date format
mm/dd/yyyy. I'm having trouble determining what the starting date is.
min(date) = 730395
max(date) = 733189
Starting at 01/01/1900, 730395 would make the min year 3901?
Thanks for any help. 5 9396
>I have a date field [sic: columns are not fields] stored as an INTEGER and need to convert to a date format [sic: temporal data is not stored formatted] has mm/dd/yyyy. I'm having trouble determining what the starting date is. <<
Before anyone can help you, you need to understand your own data.
However, once you find out what your minimum date is, then you can
build a table with (integer, datetime) columns and do a simple look
up.
Fields have formatting (think COBOL, punch cards, etc.) while columns
have a data type (think abstract data models). The reason that you
have to deal with this crap is that someone did not know the
difference.
Artie (ar*******@yaho o.com) writes:
I have a date field stored as an INT and need to convert to a date format
mm/dd/yyyy. I'm having trouble determining what the starting date is.
min(date) = 730395
max(date) = 733189
Starting at 01/01/1900, 730395 would make the min year 3901?
As Celko said, you need to know your data, and we cannot really help you
on that point. You need to consult the documentation for this database,
or find someone who knows about it.
That said, I ran this on SQL 2008:
select dateadd(day, 730395, convert(date, '0001-01-01'))
select dateadd(day, 733189, convert(date, '0001-01-01'))
And I got back:
2000-10-03
2008-05-28
Which certainly looks compelling. But again, you need to verify.
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se
Books Online for SQL Server 2005 at http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinf...ons/books.mspx
Problem is this is not my data and nobody can find any docs on this. This
is from an old version of Adapt CRM. Adapt is still around but the cheapos
I work for won't pay for support :-(
I did not think to use 0001-01-01 as a startdate since SQL was not around in
Biblical times!
Thanks for the help. You certainly got me going in the right direction.
"Erland Sommarskog" <es****@sommars kog.sewrote in message
news:Xn******** **************@ 127.0.0.1...
Artie (ar*******@yaho o.com) writes:
>I have a date field stored as an INT and need to convert to a date format mm/dd/yyyy. I'm having trouble determining what the starting date is. min(date) = 730395 max(date) = 733189
Starting at 01/01/1900, 730395 would make the min year 3901?
As Celko said, you need to know your data, and we cannot really help you
on that point. You need to consult the documentation for this database,
or find someone who knows about it.
That said, I ran this on SQL 2008:
select dateadd(day, 730395, convert(date, '0001-01-01'))
select dateadd(day, 733189, convert(date, '0001-01-01'))
And I got back:
2000-10-03
2008-05-28
Which certainly looks compelling. But again, you need to verify.
--
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se
Books Online for SQL Server 2005 at http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at http://www.microsoft.com/sql/prodinf...ons/books.mspx
>I did not think to use 0001-01-01 as a startdate since SQL was not around in Biblical times! <<
I remember that! When I was consulting for Moses, I told him those
were lousy business rules :)
Erland has a good guess; Oracle can handle dates in the CE and BCE
ranges, so the package might have be ported over that product. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Loi Tan Vo |
last post by:
Hi,
I have a text file that contains a date column. The text file will be
imported to database in SQL 2000 server. After to be imported, I want
to convert the date column to date type.
For ex. the text file look like
Name date
Smith 20003112
|
by: Lauren Quantrell |
last post by:
I have a stored procedure using Convert where the exact same Convert
string works in the SELECT portion of the procedure but fails in the
WHERE portion.
The entire SP is listed below.
Specifically, I have a problem with this portion in the WHERE clause:
DATEADD(Day,tblMyEventTableName.ReminderDays, @DateNow) Between...
|
by: Richard Hollenbeck |
last post by:
I'm trying to write some code that will convert any of the most popular
standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan
1908) and compare the first with the second and calculate days, months, and
years. This is not for a college course. It's for my own personal
genealogy website. I'm stumped about the code. I'm...
|
by: Matt |
last post by:
I would like to convert a couple informix stored procedures to SQL
Server stored procedures. I have no idea how to accomplish this. Here
is an example of one of the procedures I need to convert.
drop function mnaf_calc_calendar_quarter;
CREATE FUNCTION mnaf_calc_calendar_quarter(pEndDate Date)...
|
by: jerry.ranch |
last post by:
I have a need to convert simple dates (i.e. 02/14/2005) to a number,
do some math, and convert back to a date. (in a simple query).
The math involves adding or substracting days, and days of the week .
I've used the weekday() function to convert dates to numberic days of
the week (1-7)
I've used cdbl (date) to convert a date to a serial...
| |
by: Franck |
last post by:
Hi,
'm gettin mad about date conversion.
Here is the point.
Got and add-in for Excel which call functions from a web service (on a
remote server)
The remote server has regional settings set to "en-UK" and date to
|
by: abcabcabc |
last post by:
I write an application which can let user define own date format to input,
How to convert the date string to date value with end-user defined date
format?
Example, User Defined Date Format as "dd/MM/yyyy"
input as "01082003" convert to date value as, 01 Aug 2003
Example, User Defined Date Format as "yyyy,dd,MM"
|
by: Terry Jolly |
last post by:
New to C# ---- How do I convert a Date to int?
In VB6:
Dim lDate as long
lDate = CLng(Date)
In C#
|
by: perryclisbee via AccessMonster.com |
last post by:
I have dates of service for several people that range all over each month.
ie: patient had dates of service of: 7/3/2006, 7/24/2006 and 7/25/2006. I
need to create a new field via a query that will convert each of the records
of these service dates to the first date of that month, with results showing:
7/1/2006, 7/1/2006, 7/1/2006. How would...
|
by: deepak_kamath_n |
last post by:
Hello,
I have the following scenario:
1. My application receives the date from another application as a
string
2. The other application is running in a different time zone as
compared to my app.
3. I need to convert the received date string in to a date w.r.t my
local time zone.
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |