Print Page | Close Window

-edit- Calculating with dates???

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=4126
Printed Date: 30 March 2026 at 3:26am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: -edit- Calculating with dates???
Posted By: stDeaReG
Subject: -edit- Calculating with dates???
Date Posted: 08 July 2003 at 5:54am

!!!!new question below!!!!!

Hey, I need some help, I'm doing some calculations in ASP, but in the output i get numbers like 4,56767651221 etc.

What I need the output to be in this case would be simply 4, so basicly i need to remove all numbers that appear behind the comma from my formula results.

What command do I have to use for that?

TIA.




Replies:
Posted By: Gullanian
Date Posted: 08 July 2003 at 6:36am

strNumber = "4,3248096432"
intCommaPosition = inStr(strNumber,",")
strNumber = left(strNumber,intCommaPosition)



Posted By: stDeaReG
Date Posted: 08 July 2003 at 7:14am

thanx, another question i could use help with...

Is it possible to calculate dates, so for instance if i have a date value in my database and take the current date with now() both in the same format (like this: 8-7-2003 15:08:47).

so basicly if the database has value 8-7-2003 15:08:47 the current time is 8-7-2003 15:12:49 i would need it to output 04:02 or just 04 would do actually.

I've been trying to get it to work, but for some reason it won't



Posted By: Bunce
Date Posted: 08 July 2003 at 7:31am

do a search for the function DateDiff()

Cheers,
Andrew



-------------
There have been many, many posts made throughout the world...
This was one of them.


Posted By: stDeaReG
Date Posted: 08 July 2003 at 8:49am

Thanx bunches, working now.



Posted By: ljamal
Date Posted: 08 July 2003 at 9:55am
Originally posted by stDeaReG stDeaReG wrote:

!!!!new question below!!!!!


Hey, I need some help, I'm doing some calculations in ASP, but in the output i get numbers like 4,56767651221 etc.


What I need the output to be in this case would be simply 4, so basicly i need to remove all numbers that appear behind the comma from my formula results.


What command do I have to use for that?


TIA.



Assuming the comma is the decimal delineator, then you can you either the FIX or of the INT function depending upon whether or not you want the number rounded.

-------------
L. Jamal Walton

http://www.ljamal.com/" rel="nofollow - L. Jamal Inc : Web/ Print Design and ASP Programming



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net