Data & Time capture

Page 1 of 3 123 LastLast
Results 1 to 10 of 27

Thread: Data & Time capture

  1. #1
    Join Date
    Dec 1969
    Posts
    1,324

    Default Data & Time capture

    Trying to capture date and time, populate a variable with it, and insert it into a table. Using ASP in an application with Access database..(Not my idea, but a constraint). Application works great but need to capture system date and time when a submission is made.<BR><BR>Thanks in advance

  2. #2
    Join Date
    Dec 1969
    Posts
    168

    Default RE: Data & Time capture

    &#060;%<BR>Dim Mytime, MyDate<BR>Mytime= Time()<BR>Mydate= Date()<BR>Mytimeanddate= Now()<BR>&#037;&#062;<BR>&#060;p>The time is: &#060;%=MyTime &#037;&#062;<BR>&#060;p>The Date is &#060;%=MyDate&#037;&#062;<BR>&#060;p>It is currently: &#060;%=Mytimeanddate &#037;&#062;<BR><BR>Hope this helps... Cheers!

  3. #3
    Join Date
    Dec 1969
    Posts
    190

    Default RE: Data & Time capture

    How would I adjust the time if my server is located in a different time zone than the client machine?

  4. #4
    Join Date
    Dec 1969
    Posts
    1,013

    Default RE: Data & Time capture

    Since this is ASP code it is executed on the server. The system clock on the server will determine the time and date.<BR><BR>If you want the time on the client machine, you could simply run this code on the client instead of on the server. However the client might not have their date and time set correctly.<BR><BR>In order to determine what their time zone is you would have to do something like : capture their IP address which would somehow relate to where they are at geographically , unless they are dialed in through long distance or using IP spoofing.<BR>


  5. #5
    Join Date
    Dec 1969
    Posts
    1,013

    Default RE: Data & Time capture

    I use Front Page 2000. I typed the information script in but all it shows when I preview the page is:<BR><BR>The time is:<BR>The Date is <BR>It is currently: <BR><BR>

  6. #6
    Join Date
    Dec 1969
    Posts
    26

    Default RE: Data & Time capture

    The quickest way I&#039ve seen is<BR>&#060;% response.write Now %&#062;

  7. #7
    Tony Landa Guest

    Default RE: Date & Time - Manipulating the date and time

    I&#039ve found it&#039s useful to use the DATEADD() function<BR><BR>For example, if the server is in Chicago, and the client is in New York, replace your &#060;%=now%&#062; with the following code:<BR>&#060;%=DATEADD("h",1,now)%&#062;<BR><BR>[Text below is taken from Active Server Pages Unleashed (c)1998, Sams.net Publishing]<BR><BR>The DATEADD() function takes three arguments:<BR><BR>* The first argument specifies an interval of time.<BR>* The second argument specifies a multiplier for that interval.<BR>* Finally, the third argument is a variant or literal date or time.<BR><BR>------------------------<BR>Date and time intervals:<BR>yyyy = year<BR>q = quarter<BR>m = month<BR>y = day of year<BR>d = day<BR>w = weekday<BR>ww = week of year<BR>h = hour<BR>m = minute<BR>s = second<BR>-----------------<BR><BR>Some other examples:<BR><BR>Your registration will expire in six weeks, on &#060;%=DATEADD("ww",6,DATE)%&#062;<BR><BR>Your computer will melt at &#060;%=DATEADD("s",15,TIME)%&#062;, exactly 15 seconds from now.

  8. #8
    Join Date
    Dec 1969
    Posts
    226

    Default RE: Data & Time capture

    How would you format the date so that instead of 8/22/00, you get August 22, 00?

  9. #9
    Join Date
    Dec 1969
    Posts
    98

    Default RE: Data & Time capture

    Use the following code:<BR><BR>FormatDateTime(now(), vbLongDate)<BR>FormatDateTime(#8/22/00#, vbLongDate)<BR><BR>This, however, produces Tuesday, August 22, 2000. I think you can only change this by changing the date format on the server.<BR>

  10. #10
    BalletChick Guest

    Default RE: Date & Time - Manipulating the date and time

    Use &#039n&#039 for minutes, not &#039m&#039

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •