Wrox Programmer Forums
|
Classic ASP Components Discussions specific to components in ASP 3.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Components 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 August 4th, 2004, 11:00 AM
Authorized User
 
Join Date: Jul 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to blueguy
Default Time Convert in ASP ;Please help

it it possible to abstract this time 03.08.2004 14:01:22 from
04.08.2004 17:44:53. And get a conclusion like hour:min format
in ASP

 
Old August 4th, 2004, 06:12 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

No, however is is possible in VBScript (probably what you meant)
Use the TimeValue function:

TimeValue("date string Value")

The time argument is usually a string expression representing a time from 0:00:00 (12:00:00 A.M.) to 23:59:59 (11:59:59 P.M.), inclusive. However, time can also be any expression that represents a time in that range. If time contains Null, Null is returned.

EG
Dim result
result = TimeValue("03/08/2004 14:01:22")
response.write "The time is: " & result


Wind is your friend
Matt
 
Old August 5th, 2004, 01:54 AM
Authorized User
 
Join Date: Jul 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to blueguy
Default

Thanks for your answer but

i want to abstract this time 03.08.2004 14:01:22 from
04.08.2004 17:44:53. And get conclusion like this 27hour.25minute format
in ASP



 
Old August 5th, 2004, 02:15 AM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

do you mean the difference between the dates?

Go to Google and search for the dateDiff and datePart functions if this is the case.

Wind is your friend
Matt
 
Old August 5th, 2004, 02:40 AM
Authorized User
 
Join Date: Jul 2004
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to blueguy
Default

i want to subtract this time 03.08.2004 14:01:22 from
04.08.2004 17:44:53. And obtain this format 27h.25
in ASP


 
Old August 5th, 2004, 02:48 AM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

The dateDiff functionis what you need

Returns the number of intervals between two dates.

DateDiff(interval, date1, date2 [,firstdayofweek[, firstweekofyear]])

Arguments
interval (you want to put 'h' for hour)
Required. String expression that is the interval you want to use to calculate the differences between date1 and date2.

date1, date2 (put your two dates here)
Required. Date expressions. Two dates you want to use in the calculation.

firstdayofweek
Optional. Constant that specifies the day of the week. If not specified, Sunday is assumed.

firstweekofyear
Optional. Constant that specifies the first week of the year. If not specified, the first week is assumed to be the week in which January 1 occurs.



Wind is your friend
Matt
 
Old August 5th, 2004, 02:49 AM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

BTW you will have use string formatting to get your 27h.25 as this can not be a date variant due to its syntax

Wind is your friend
Matt





Similar Threads
Thread Thread Starter Forum Replies Last Post
convert time field to number jobalistic Access 17 February 22nd, 2013 12:40 PM
Convert UNIX Time to MS Access Corey Linux 4 April 7th, 2009 11:52 AM
convert time to minutes stolte XSLT 3 November 21st, 2008 04:12 AM
[Resolved] Convert Time to Integer snufse ASP.NET 2.0 Basics 1 October 7th, 2008 11:44 AM
Convert String To Time GailCG ASP.NET 2.0 Basics 1 January 9th, 2008 01:09 AM





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