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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to pick out characters from a variable? 1

Status
Not open for further replies.

JohanF

Programmer
Aug 29, 2002
6
SE
A simple question.. I guess!

The Time function returns a value like this: 02:08:30. I need to pick out the hour from the Time function, that is in this case "02" and then put 02 in a new variable.

<%
Dim realtime, hour
realtime = Time
hour = ?????

%>

Anyone?
/J
 


You can get the hour by doing this:
Code:
Dim strHour

strHour = hour(time)
If you are trying to get the hour out of a &quot;set&quot; time and not the realtime then use DatePart
Code:
Dim strTime, strTheHour

strTime = &quot;02:08:30&quot;

strTheHour = DatePart(&quot;h&quot;,strTime)
You also could change strTime to Time...


Hope that helps.
- Jason
www.vzio.com
ASP WEB DEVELOPMENT



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top