Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Basics
|
ASP.NET 2.0 Basics If you are new to ASP or ASP.NET programming with version 2.0, this is the forum to begin asking questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 7th, 2008, 11:27 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 205
Thanks: 4
Thanked 0 Times in 0 Posts
Default [Resolved] Convert Time to Integer

I am trying to convert a time column in my data set to an integer. Been trying different way but cannot get it to work:

Code:
Dim ts As New TimeSpan
ts = TimeSpan.Parse(myRow.Item(3))
Dim zDate As New Date(ts.Ticks)
Dim myTime As Integer = Format(zDate, "HHmmss")
Example: If time is 09:35:48 I need to covert it to 093548.

Error: Conversion from type 'TimeSpan' to type 'String' is not valid.
 
Old October 7th, 2008, 11:44 AM
Friend of Wrox
 
Join Date: Mar 2007
Posts: 205
Thanks: 4
Thanked 0 Times in 0 Posts
Default

Mybe not the right way, but got it working like this:

Code:
Dim ts As New TimeSpan
ts = myRow.Item(3)
Dim zDate As New Date(ts.Ticks)
Dim myTime As Integer = Format(zDate, "HHmmss")





Similar Threads
Thread Thread Starter Forum Replies Last Post
convert time to minutes stolte XSLT 3 November 21st, 2008 04:12 AM
[Resolved] Group date and time snufse SQL Language 8 October 24th, 2008 02:35 PM
convert web unit (pixels) to integer ubercat ASP.NET 1.0 and 1.1 Professional 0 August 8th, 2006 06:51 PM
Convert string from text box to integer ja8261 VB.NET 2002/2003 Basics 5 November 6th, 2004 10:04 PM
convert string to integer kcheung Classic ASP Databases 1 July 28th, 2003 04:39 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.