473,412 Members | 3,860 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,412 software developers and data experts.

Timestamp to date

3
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 24520
BSOB
77
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
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
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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...
0
tracyyun
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...
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
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...

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.