Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP 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
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old August 6th, 2004, 06:04 AM
Authorized User
 
Join Date: Jul 2004
Location: , , Turkey.
Posts: 13
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to blueguy
Default find time difference? possible using Asp?

Problem is

I get a time formatted 06.08.2004 13:57:13(system time) from a table that is saved before in SQL Server.

I want to use asp that subtracts that time from current time .
Is that possible

give the codes


<%



Time=Request.form("Time"))
?????? Time1=Time - Now()

SoruNo=Request.Form("SoruNo")
Durum=Request.Form("Durum")
Durum1=Durum+1
CevapIP=Request.ServerVariables("REMOTE_HOST")

                SQL="Update Danismanlik Set "
                SQL=SQL & "Link='" & Link1 & "',"
                SQL=SQL & "CevapIP='" & CevapIP & "',"
                SQL=SQL & "CevapTarih='"&now&"',"
                SQL=SQL & "Durum='" & Durum1 & "'"
                SQL=SQL & "Time Difference='" & Time1 & "'"
                SQL=SQL & " Where SoruNo='" & SoruNo & "' And Durum='" & Durum & "'"
                Set CevapEkle=VeriTabani.Execute(SQL)
                Set CevapEkle=Nothing

%>

<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-9">
</head>


<body marginwidth="0" marginheight="0" leftmargin="0" topmargin="0">
<center>
    Cevaba ait Sayfa Adresi Eklenmesi Tamamlanmýþtýr.
    <br>Geri Dönmek için lütfen <a href="javascript:history.go(-1)">týklayýnýz</a>

    <br>
    <br>

  <input type="button" name="Submit2" value="Pencereyi Kapat" onClick="window.close()">
</center>

</body>
</html>


Reply With Quote
  #2 (permalink)  
Old August 6th, 2004, 08:33 AM
Friend of Wrox
 
Join Date: Aug 2003
Location: , , .
Posts: 205
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Use the DateDiff function.

Yehuda
Reply With Quote
  #3 (permalink)  
Old August 6th, 2004, 08:19 PM
Friend of Wrox
 
Join Date: Sep 2003
Location: Mentiri, Muara, Brunei.
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default


Yes, use datediff

  dim tim1,tim2,restime
 restime=datediff(interval,time1,time2)
where interval is
   n - minutes
   s - second
   h - hours



Reply With Quote
  #4 (permalink)  
Old August 6th, 2004, 08:24 PM
Friend of Wrox
 
Join Date: Jun 2003
Location: Bangalore, KA, India.
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Here you go...

Datediff Function

Cheers!

_________________________
- Vijay G
Strive for Perfection
Reply With Quote
  #5 (permalink)  
Old January 23rd, 2006, 02:11 AM
Registered User
 
Join Date: Jan 2006
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to vincee
Default

cant be used...
the output is:

org_time due_time time_diff
1629 1630 1440
751 800 70560
1521 1530 12960

which is not correct.
or mayb can someone explain?
Reply With Quote
  #6 (permalink)  
Old January 23rd, 2006, 04:49 AM
Registered User
 
Join Date: Jan 2006
Location: , , .
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to vincee
Default

need to add on:
those twe columns datatype is int
do i need to convert it to datetime format 1st?
if yes, how?
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Get Difference timing Between Two Time smmedicals Pro VB Databases 1 August 11th, 2008 01:57 PM
Calculating a time difference SQLScott SQL Server 2005 11 October 25th, 2007 02:42 AM
difference in time MunishBhatia ASP.NET 2.0 Professional 0 September 5th, 2007 09:03 AM
Find months difference tsimsha Classic ASP Databases 4 February 14th, 2005 08:36 PM
Time difference spraveens PHP How-To 4 September 20th, 2004 07:00 AM



All times are GMT -4. The time now is 06:34 AM.


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