Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Time and Access
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

kolucoms6
Average Member

845 Posts

Posted - 19 April 2008 :  19:35:12  Show Profile

What the best way to save Time in Access ?

Like should i save it as text and then when I call the same in ASP, or Saving it as Time as DateTime format type ?

Preferable to save it as 24 hour format or 12 hour format ?

My purpose is to Update the Record with Call Back time and then a PopUp ( alwys On and querying db eveyr 15 mins ) will display that record if its within the range of current time.

MaD2ko0l
Senior Member

United Kingdom
1053 Posts

Posted - 19 April 2008 :  21:21:18  Show Profile  Visit MaD2ko0l's Homepage
i would use text to store the date/time as i have had issues when useing the DateTime format

i usually use the snitz function to change the date/time to hat i need it to be (StrToDate i think it is)

© 1999-2010 MaD2ko0l
Go to Top of Page

kolucoms6
Average Member

845 Posts

Posted - 19 April 2008 :  22:27:08  Show Profile
StrToDate is in which file ?
Go to Top of Page

MaD2ko0l
Senior Member

United Kingdom
1053 Posts

Posted - 19 April 2008 :  22:34:36  Show Profile  Visit MaD2ko0l's Homepage
inc_func_common.asp maybe?

© 1999-2010 MaD2ko0l
Go to Top of Page

kolucoms6
Average Member

845 Posts

Posted - 20 April 2008 :  14:23:37  Show Profile
My purpose is to Update the Record with Call Back time and then a PopUp ( alwys On and querying db eveyr 15 mins ) will display that record if its within the range of current time.

Any Suggestions on it ?
Go to Top of Page

gary b
Junior Member

USA
267 Posts

Posted - 20 April 2008 :  17:14:35  Show Profile  Visit gary b's Homepage
Just a point to consider...

If time recorded as text, it is not easy to perform calculations.
1. Built-in functions (such as DiffDate) do not work on dates as text. 2. You cannot easily do a date compare, like:
If DateAsText = Date() Then
Do something
Else
Do nothing or do something else
End If
3. Given a date, I can set a 'trigger' by calculating a future date... like callBackDate = registerDate + 14

Access will accept time in many formats. I normally use Short date -- such as 01/31008 -- and default value = Date(). If you need times, I use Now() -- both date and time. Set Access field format to date or time or both. Don't forget that date inputs in Access are indicated by # prefix/suffix, like #01/31/2008#.

I will use dates (that is, non-text values) whenever possible -- mainly because I use functions/calculations.

HTH some...
Go to Top of Page

kolucoms6
Average Member

845 Posts

Posted - 20 April 2008 :  20:09:01  Show Profile
So, best way is :

1) Set Field datatype as Date/Time.
2) Save time as hh:mm:ss AM/pm
3) When Retrieving , Extract time from the field and compare time value with current time.

Is that so ?
Go to Top of Page

gary b
Junior Member

USA
267 Posts

Posted - 20 April 2008 :  21:41:01  Show Profile  Visit gary b's Homepage
If your focus is time, then yes. If there is a function Time(), you could then match database value with *current* time and direct/call necessary/desired action.

You may find these pages useful:
http://www.w3schools.com/VBscript/func_time.asp
http://www.w3schools.com/vbscript/vbscript_ref_functions.asp
http://www.w3schools.com/ASP/showasp.asp?filename=demo_asp_formatdatetime
http://www.codetoad.com/asp/format_date_time.asp

Just thinking out loud here...
You could run a stored procedure/database query every 15 min (?) that filters on database time values such as:

currentTime >= registerTime AND currentTime <= registerTime + 240Hrs

Again, the exact values and methods depend on what you want to do.

HTH...



Edited by - gary b on 20 April 2008 21:46:51
Go to Top of Page

kolucoms6
Average Member

845 Posts

Posted - 20 April 2008 :  21:54:26  Show Profile
My server displays PST time.

CBTime stores the time in PST also.

From DB , I want to retrieve records like

select col1,col2 from Table where CBTime between time() and dateadd("n",time,15)

Above query shld display all records where CBTime is next 15 minutes.

Right ?

Also, is it advisable to store time in 24 or 12 hour format ?

Edited by - kolucoms6 on 20 April 2008 21:55:36
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2019 Snitz™ Communications Go To Top Of Page
This page was generated in 0.03 seconds. Powered By: Snitz Forums 2000 Version 3.4.07