473,406 Members | 2,549 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,406 software developers and data experts.

EPOCH Time

Can someone suggest me how do i write a code in VB for
epoch time. I want if the value is entered it changes into
time and if time is enetred i get the value
Nov 20 '05 #1
2 5826
Hello,

"Sunil" <su***@intouchworld.com> schrieb:
Can someone suggest me how do i write a code in VB for
epoch time. I want if the value is entered it changes into
time and if time is enetred i get the value


Can you explain what EPOCH time is?

Regards,
Herfried K. Wagner
--
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #2
Hi Sunil,

In VB.NET dates and times are stored in a DateTime structure. The epoch
for these is 00:00:00.0000000, January 1, 0001.

DateTimes have a Ticks value which is the number of 100-nanosecond
intervals which have elapsed since then.

You can convert to and from by getting the Ticks value, and by adding
Ticks to an existing DateTime.

Try the following:

Dim dt0 As DateTime = #12/25/2003#
Dim dt1 As DateTime = DateTime.MinValue
Dim dt2 As DateTime = DateTime.MinValue
dt2 = dt2.AddTicks (dt0.Ticks)
MsgBox (dt0.ToString & ", " & dt0.Ticks & vbCrLf _
& dt1.ToString & ", " & dt1.Ticks & vbCrLf _
& dt2.ToString & ", " & dt2.Ticks & vbCrLf)

Note that dtVar.AddTicks (23) does <not> add 23 Ticks to dtVar but
produces a new DateTime which has the sum of the Ticks.

Regards,
Fergus
Nov 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: John Hunter | last post by:
I have a python2.3 datetime instance and a tzinfo instance (eg Eastern from the python library reference). What is the best way to convert that datetime instance to seconds since the epoch,...
2
by: Darren Ferguson | last post by:
Hey all I am trying to extract the epoch from a timestamp variable in plpgsql. The function is as follows: create or replace function test() returns integer as ' declare _test timestamp with...
5
by: Summu82 | last post by:
HI I have to convert a time in the format i have year month day hour min and seconds I need to convert this into time in seconds since 1 jan 1970 i.e the
1
by: Astan Chee | last post by:
Hi, I have a string in this format "DD/MM/YYY" for example: tdate = "18/01/1990" and Im trying to convert this to epoch time, can anyone help? Im also trying to convert that epoch time to the...
3
by: Mark | last post by:
I want to simply get the unix style epoch time (number of secs to now from Jan 01, 1970 UTC) for use as a timestamp to track the staleness of some objects. So I don't care about time zones or...
5
by: Grey Alien | last post by:
I need to convert timestamps that are given as the number of seconds that have elapsed since midnight UTC of January 1, 1970, (not counting leap seconds). It seems all of the std C functions...
11
by: usenet | last post by:
Is the epoch time the number of seconds elapsed since January 1st 1970 in my timezone or as per UTC? I mean, if A's program makes a call to time() in Melboune and B's program makes a call to...
2
by: Richard Rossel | last post by:
Hi friends, I need a little help here, I 'm stuck with epoch calculation issue. I have this datetime: date_new = datetime(*time.strptime('20080101T000000','%Y%m%dT%H%M%S') ) This date_new is in...
6
by: pavanponnapalli | last post by:
hi, i am using Date::Time and using localtime function to convert a given timestamp to epoch seconds. Everything is fine. The problem comes when we give date someting like 2008-11-31 04:45:45...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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
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
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...

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.