473,372 Members | 1,021 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,372 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 5819
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: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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?
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...

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.