Welcome to Dream.In.Code
Become an Expert!

Join 150,051 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,703 people online right now. Registration is fast and FREE... Join Now!




im hoping you could help

 
Reply to this topicStart new topic

im hoping you could help

didgy58
22 Feb, 2008 - 02:12 AM
Post #1

D.I.C Head
**

Joined: 23 Oct, 2007
Posts: 217



Thanked: 1 times
My Contributions
hi people not sure if i am in the right place as this is a combination question i think, ok ive got my asp page using a microsoft access database, in the asp page im doings a select all from the table , and this is displaying all my info ok that works fine, i want to refine it a little though. so i thought id do it over the time

so i got this
CODE


time= FormatDateTime(Now(), vbShortTime)
time2=dateadd("h",-3,time)



and this works fine it returns the time now minus 3 hours which is what i want, when it writes it out on the screen its in the following format

hh.mm.ss.

2 things i was wondering how could i make it just bring out the hh.mm?? and secondly i would like to use this value and make a sql much like this

select * from table where sta >= time 2

ive tried it but get a datatype mistmatch error,
sta is a date/time in the database, should i consider changing it to text and maybe it will work?? or is it because ive got the seconds in my time2 and need to change it to just hour and minute?

any help would be very much appriciated

thanks

dan
User is offlineProfile CardPM
+Quote Post

Jayman
RE: Im Hoping You Could Help
22 Feb, 2008 - 03:43 PM
Post #2

Student of Life
Group Icon

Joined: 26 Dec, 2005
Posts: 7,319



Thanked: 66 times
Dream Kudos: 500
Expert In: Everything

My Contributions
You can find information on formating custom data time formats here.

For your SQL statement, if the data is stored as a date/time in the database, then you will need to convert the value to a datetime value in order for the statement to execute properly.
User is offlineProfile CardPM
+Quote Post

didgy58
RE: Im Hoping You Could Help
23 Feb, 2008 - 02:24 AM
Post #3

D.I.C Head
**

Joined: 23 Oct, 2007
Posts: 217



Thanked: 1 times
My Contributions
thanks very much jayman, sorted stuff out a treat it used the following sql and it works nicely

CODE


select * from Flights where (eta>= (dateadd('h',-3,Time())) and (dataa=Date())




User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/8/09 10:16PM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month