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

Convert Numeric Format to Time Format

Hey,

Im having trouble with converting a Numeric value (such as a single
digit number like 1 or 5) into a time format.

I need to convert a number entered into a variable into Hours on the
first form, then from Hours into Seconds when a second form is loaded.

Anyone got any ideas? If you need more info, let me know and ill post
a code snippet or something.

Cheers.

Mar 8 '07 #1
7 14890
Doh, i was supposed to put "Hours into Minutes when a second form is
loaded" Not hours into seconds >.<
Mar 8 '07 #2
Hi,

dim mydate as datetime = new datetime(yy,MM,dd,hh,mm,ss)

I hope this helps,

Cor
<Wo***********@googlemail.comschreef in bericht
news:11**********************@v33g2000cwv.googlegr oups.com...
Hey,

Im having trouble with converting a Numeric value (such as a single
digit number like 1 or 5) into a time format.

I need to convert a number entered into a variable into Hours on the
first form, then from Hours into Seconds when a second form is loaded.

Anyone got any ideas? If you need more info, let me know and ill post
a code snippet or something.

Cheers.

Mar 8 '07 #3
Umm.. can i ask - where is that meant to go within my code? And how
does it achieve what i need it to do?

Mar 8 '07 #4
Since the world is ending, does it really matter?

<Wo***********@googlemail.comwrote in message
news:11*********************@c51g2000cwc.googlegro ups.com...
Umm.. can i ask - where is that meant to go within my code? And how
does it achieve what i need it to do?

Mar 8 '07 #5
God damn your funny ¬.¬ Not..

Mar 14 '07 #6
Wo***********@googlemail.com wrote:
Hey,

Im having trouble with converting a Numeric value (such as a single
digit number like 1 or 5) into a time format.

I need to convert a number entered into a variable into Hours on the
first form, then from Hours into Seconds when a second form is loaded.

Anyone got any ideas? If you need more info, let me know and ill post
a code snippet or something.

Cheers.
You can create a TimeSpan value from the hours:

Dim time As TimeSpan = New TimeSpan(hours, 0, 0)

The TimeSpan structure has properties you can use to get components of
the time, like Hours, Minutes and Seconds. It also has properties to
express the entire time span in units, like TotalHours, TotalMinutes and
TotalSeconds.

Example:

Dim hours As Integer = 4
Dim time As TimeSpan = New TimeSpan(hours, 0, 0)
Dim minutes As Double = time.GetTotalMinutes

The minutes variable now contains 240.0.

--
Göran Andersson
_____
http://www.guffa.com
Mar 15 '07 #7
Hello Göran,

In VB.Net I believe the Timeserial/Dateserial function is still there. You
can probably use it too
-- You can do anything with a little bit of 'magination.

-- I've been programming so long, my brain is now software.
Wo***********@googlemail.com wrote:
>Hey,

Im having trouble with converting a Numeric value (such as a single
digit number like 1 or 5) into a time format.

I need to convert a number entered into a variable into Hours on the
first form, then from Hours into Seconds when a second form is
loaded.

Anyone got any ideas? If you need more info, let me know and ill post
a code snippet or something.

Cheers.
You can create a TimeSpan value from the hours:

Dim time As TimeSpan = New TimeSpan(hours, 0, 0)

The TimeSpan structure has properties you can use to get components of
the time, like Hours, Minutes and Seconds. It also has properties to
express the entire time span in units, like TotalHours, TotalMinutes
and TotalSeconds.

Example:

Dim hours As Integer = 4
Dim time As TimeSpan = New TimeSpan(hours, 0, 0)
Dim minutes As Double = time.GetTotalMinutes
The minutes variable now contains 240.0.

Mar 15 '07 #8

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

Similar topics

1
by: Bruce Cushman | last post by:
My DB is Access 2000 based "possibly written in 2002" and I have to send and receive update files, ported to a UNIX server by FTP, DB unknown. The file content uses a fixed length string, zero...
1
by: seash | last post by:
H when i execute this query, my query is crashing throwing an exception "cant convert char datatype to datetime type format my query is "insert into mytable(mydate) values ('"+ varmydate+ "')...
3
by: Just D | last post by:
Did anybody see this bug? I tried to reproduce that using 12-hour and 24-hour system settings. Anyway it still causes a problem in VS2003. When I convert DateTime to a string using default...
9
by: romy | last post by:
It used to work in vb6. I don't know the syntax in vb.net current date and time.... format (cstr(date),"DDMMYY") format(cstr(time),"HHMM") thanks
5
by: rouven | last post by:
Hi, i am trying to convert that time format '05:26:40 Jun 19, 2007 PDT' into mysql compatible format like YYYY-MM-DD HH:MM:SS. the code i tried was: from datetime import datetime from time...
1
by: getnitha | last post by:
how to convert a number to time format in vb.net eg: 8 to 8:00:00 i am storing in sql server number as nvarchar while retreiving in code i need to convert it as 8:00:00 for further calculations...
4
by: sayli | last post by:
I have 00:01:00 in a string. I want to convert it into time format. How can i do this?
18
by: Dirk Hagemann | last post by:
Hello, From a zone-file of a Microsoft Active Directory integrated DNS server I get the date/time of the dynamic update entries in a format, which is as far as I know the hours since january 1st...
3
by: smitanaik | last post by:
hi help me out to convert this unix time format into windows in java ex. 1075329297.572 (unix time format)
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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
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
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.