473,466 Members | 1,455 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Timestamp to date

3 New Member
Hi

I have a time in a time stamp format e.g 17917009.03 (seconds) and im wanting to convert it to a date and time. The value has been collected from a piece of equipment that uses the value for the date and the time.
Are there any pre built functions to convert this number to a date and time?

Cez
Aug 1 '06 #1
4 24525
BSOB
77 New Member
searched, didnt find one, and im surprised. if you want to change your questions from "pre built functions" to "functions", you will get lots of responses.
Aug 1 '06 #2
cez
3 New Member
Hi i have finally found an answer

Typicaly the two pieces of equipment i am using are different in their methods of giving the date (even though they are made by the same people).

solution

one uses the unix timestamp so

a = some date in unix time stamp
b = DateAdd("s", a, #1/1/1970#)

the other piece of equipment starts its counter on the first day of each year so

a = the equipments counter
b = DateAdd("s", a, #1/1/2006#)

sorted

cheers for having a look BSOB

Cez
Aug 2 '06 #3
BSOB
77 New Member
a = the equipments counter
b = DateAdd("s", a, #1/1/2006#)

in regards to that ^, well done, and i dont mean to be a bug, and im sure youve thought of this, but i dont want some machine failing because i assumed youd thought of it: 2006 will only last another few months, you may want this to still work next year.
thats all.
Aug 3 '06 #4
cez
3 New Member
Yes i had thought of this but thanks for pointing that out. Ive ended up getting the user to do enter the year. Ive also made it in to a function for vb,excel,access etc

Public Function PPMS_Timestamp_to_Date(TimeStamp As Double, year_yyyy As Double) As Date
' This function takes the current year and the time stamp from the mpms and works out the correct time and date
'the mpms time stamp starts on the first of each year

Dim startofyear As Date
startofyear = CDate("1/1/" + Str(year_yyyy)) ' calculate start of year
PPMS_Timestamp_to_Date = DateAdd("s", TimeStamp, startofyear) ' add time stamp to current year

End Function


If you have any more efficient ways of doing this or refining it i would like to know. Im a bit rusty on my vb at the moment. just getting back in to it

Cheers

Cez
Aug 3 '06 #5

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

Similar topics

2
by: praba kar | last post by:
Dear All, In Php strtotime() will change a date string into timestamp. I want to know which python function will change a date string into timestamp. Date string format is below
3
by: Michael Hertz | last post by:
I am performing a XSLT stylesheet on a XML document and produce a new XML document. How can I insert in this new XML stylesheet a tag <currtime>..."the current date/time"....</currtime> where...
3
by: Shelly | last post by:
Can anyone help? Here is what I have (part, at least) echo $dbResult . ' ' . $dbResult . ' ' . $dbResult . " " . date("M j, Y, g:i a", $dbResult) . '<br>'; Here is what it puts out ...
2
by: Jim Piellier | last post by:
I use desinger to generate ddl script. in some tables, I have table column using timestamp, but in generated ddl, all timestamp type became date, anyone know why? and how can I fix it? oracle...
7
by: Ross | last post by:
Hi, I want to change this query SELECT current timestamp FROM sysibm.sysdummy1; so it returns 2005-11-09-00.00.0.000000 not 2005-11-09-15.31.33.132000. Basically stip the time of the timestamp...
2
by: Campano, Troy | last post by:
Hi, I'm trying to compare a timestamp to current_timestamp but I'm having trouble. I want to compare just the date piece of my timestamp column to just the date piece of current_timestamp. ...
2
by: Russell Smith | last post by:
Timestamps support infinity. However if appears dates do not. When timestamps are cast to dates, there is no output. Is this an acceptable option or not? Below are a number of examples...
4
by: hph | last post by:
Okay, another trivial matter that I can't solve. I have a variable - $lastdate - that is the latest date any record in a MySQL database was updated. Its MySQL format is TIMESTAMP. If I say I...
3
by: krithikas | last post by:
I have a table (which i cannot modify) where date and time fields are stored as VARCHAR. But i have to cast these fields into timestamp. My requirement is like, timestamp (select date, time where...
1
by: PeterEBM | last post by:
Can anyone help with my embedded SQL in a old mainframe COBOL application that also runs on Windows. The SQL that is failing is a pretty standard SELECT and in the WHERE clause I am comparing some...
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
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
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.