Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

format time

Status
Not open for further replies.

moleboy

IS-IT--Management
Oct 10, 2002
33
0
0
GB
I'm trying to format txttime using

Cdate(Request.Form ("txtTime"))

the input into txtTime is '0800' but this returns 0 when formatted.

can any one help?

Moley
 
Well the defaul date/time format Cdate expects it's usually mm/dd/yy h:m:s AM/PM or what date/time locale are you using

Do you want to store only Time? not the date to? you could use numeric fields for hours, mins, etc and not Date/Time fields

________
George, M
 
I only want to store the time and discard all other info.
 
Well i use 2 ways of dealing this
1. Date/Time fields
use same date for all times and store it to database
myTime="1/1/1900" & Mid(Request.Form ("txtTime"),1,2) & ":" & Mid(Request.Form ("txtTime"),3,4) & ":00"

2. Text field
myTime=Request.Form ("txtTime")

Both ways you can compare the time if the time is like your format (1256 or 2300)

________
George, M
 
Oops i've made 1 error

Mid(Request.Form ("txtTime"),3,4) should be Mid(Request.Form ("txtTime"),3,2)

________
George, M
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top