473,387 Members | 1,892 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,387 software developers and data experts.

Date/time question

DGR
I have a time value in the number of seconds since 1970. I need to convert
this into a date/time format such as MM/DD/YYYY HH:MM or something similar.
This value needs to display in terms of the local time/time zone on which my
program is running.

Are there any built-in functions that do this conversion that take time zone
into account? I'm not sure where to find any VB.NET time-related functions.

Thanks for any help you can provide.
Nov 20 '05 #1
2 6653
dg******@aol.comnospam (DGR) scripsit:
I have a time value in the number of seconds since 1970. I need to convert
this into a date/time format such as MM/DD/YYYY HH:MM or something similar.
This value needs to display in terms of the local time/time zone on which my
program is running.

Are there any built-in functions that do this conversion that take time zone
into account? I'm not sure where to find any VB.NET time-related functions.


Have a look at the 'DateTime' and 'TimeSpan' classes.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
<http://www.mvps.org/dotnet>
Nov 20 '05 #2
"DGR" <dg******@aol.comnospam> schrieb
I have a time value in the number of seconds since 1970. I need to
convert this into a date/time format such as MM/DD/YYYY HH:MM or
something similar. This value needs to display in terms of the local
time/time zone on which my program is running.

Are there any built-in functions that do this conversion that take
time zone into account? I'm not sure where to find any VB.NET
time-related functions.

Thanks for any help you can provide.


dim d as date
d = #1/1/1970#.AddSeconds(NoOfSeconds)

Is the value the local zone or UTC? If it is UTC:

d = d.tolocaltime
--
Armin

Nov 20 '05 #3

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

Similar topics

7
by: What-a-Tool | last post by:
How does the expire date work setting it server side with asp. I know with javascript setting it client side it will be set to the clients local time, and therefore expire when the clients local...
2
by: mirza i | last post by:
thanks for the previous replies. here is the new question (i'm absolutely sure that this should be VERY easy for a good js coder) ok: from asp i call: <img src="pics/cal.gif"...
7
by: Jerome | last post by:
Hallo, I know a lot has already been told about date/time fields in a database but still confuses me, specif when dealing with SQLserver(Express). It seems that sqlserver only accepts the date in...
13
by: maflatoun | last post by:
Hi, I have the following function to convert UTC time to Local time. It works perfect for GMT- (Minus) time zones however it provides incorrect results for GMT+(Plus) time zones? // Format to...
6
by: Luvin lunch | last post by:
Hi, I'm new to access and am very wary of dates as I have limited experience in their manipulation and I know if they're not done properly things can turn ugly quickly. I would like to use a...
44
by: user | last post by:
Hi, Let's say I have 2 dates in the b/m format: Date 1 and date 2 How do I check whether Date2 is later than Date 1? Date1. 21-Nov-2006 09:00:00 PM
2
by: John Dann | last post by:
I have a standard .Net DateTime variable to which I want to add a time value. The catch is that the time value is only readily available as a string as "HH:mm". Question is whether there's a...
10
by: ARC | last post by:
Hello all, General question for back-end database that has numerous date fields where the database will be used in regions that put the month first, and regions that do not. Should I save a...
9
by: Martin | last post by:
I'm retrieving some records from a database. One of the fields contains a date/time. I would like to format it as I send it out to the table in the displayed page. Can some one please tell me...
6
by: Geoff Cox | last post by:
Hello, at the moment I can add the combined date and time into MySQL using php $dt1 = date("Y-m-d H:i:s"); is it possible to add the date and time separately? I thought it might 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: 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: 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: 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...
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...

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.