473,396 Members | 1,838 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Convert integer to datetime

I have a software that save's datetime into an integer field. For example:

21 Fev 2007 09:45:07 --> 745083669
21 Fev 2007 10:19:39 --> 745182735
22 Fev 2007 10:08:14 --> 745185806
22 Fev 2007 10:08:17 --> 745185809

I like to know how to convert interger field to datetime type.

Any help will be greatly appreciated, thanks in advance
Feb 27 '07 #1
4 11148
dorinbogdan
839 Expert 512MB
It seems that the program is using a reference date, and return the difference between a second date and reference date in seconds.

Compare the result of this query against your values:
Expand|Select|Wrap|Line Numbers
  1. SELECT DATEADD(ss, 745083669, '07/13/1983 18:03:58')
  2. , DATEADD(ss, 745182735, '07/12/1983 15:07:24')
  3. , DATEADD(ss, 745185806, '07/13/1983 14:04:48')
  4. , DATEADD(ss, 745185809, '07/13/1983 14:04:48')
  5.  
Feb 27 '07 #2
almaz
168 Expert 100+
Integer values don't look like datetime values, at least using standard transformation logic. Standard transformation logic is to store the number of units (seconds/minutes/hours/whatever) between particular datetime value and required one, and it can be easily determined by searching for proportion between datetime and integer values, but your sample doesn't have it.
Feb 27 '07 #3
Tanks for your help.

But i need to find out what datetime i will use to add the seconds.
Do you have a clue to do that?

HELP MEEEEE...

It seems that the program is using a reference date, and return the difference between a second date and reference date in seconds.

Compare the result of this query against your values:
Expand|Select|Wrap|Line Numbers
  1. SELECT DATEADD(ss, 745083669, '07/13/1983 18:03:58')
  2. , DATEADD(ss, 745182735, '07/12/1983 15:07:24')
  3. , DATEADD(ss, 745185806, '07/13/1983 14:04:48')
  4. , DATEADD(ss, 745185809, '07/13/1983 14:04:48')
  5.  
Feb 27 '07 #4
dorinbogdan
839 Expert 512MB
It seems that your values are based on 3 different reference dates, so it is not fixed:
07/13/1983 18:03:58
07/12/1983 15:07:24
07/13/1983 14:04:48
07/13/1983 14:04:48

You should better analyze that program or contact the author in order to provide out the algorithm that generates the reference dates.
Feb 28 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Ste | last post by:
Hi, I have a dump with a table with this field: "hdstart" integer which contains integer like 1042758000 1028152800 etc etc How can I convert it to a SQL Server DateTime field? Thank in...
19
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....
1
by: Logan X via .NET 247 | last post by:
It's official....Convert blows. I ran a number of tests converting a double to an integer usingboth Convert & CType. I *ASSUMED* that CType would piggy-back ontop of Convert, and that performance...
4
by: v0lcan0 | last post by:
I’m trying to cast and integer type to a varchar and then concatenate two varchar and ’01’ and convert it into datetime with the following code: CONVERT(datetime, { fn CONCAT({ fn...
2
by: Chris | last post by:
Hello, How can i convert a C++ CTime (4 bytes) into a C# DateTime ? (my CTime is read in a file). Thanks, -- Chris
5
by: Learner | last post by:
Hello, Here is the code snippet I got strucked at. I am unable to convert the below line of code to its equavalent vb.net code. could some one please help me with this? static public...
17
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#
5
by: =?Utf-8?B?U2hlbGRvbg==?= | last post by:
Hello - I have about ten integer values that each need to be converted to days, hours, minutes and seconds. I can't seem to find a formula for same that works. These integer values come from a...
3
by: =?Utf-8?B?U2hlbGRvbg==?= | last post by:
Hello - I have various times formatted like 00:00:00, so for example, 01:32:05 would be one thirty-two with five milliseconds. I need to convert this into seconds (an integer). First of...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
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,...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.