Firs two characters of a var

08-17-03, 01:41 PM
|
|
ASP Guru
|
|
Join Date: Jun 2003
Location: UK
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
Firs two characters of a var
Hello.
How do I get the first to characters of a var? I was told I needed to use Left() or something? Could some please explain how to use this sub properly?
TIA 
|

08-17-03, 02:41 PM
|
|
Coding Addict
|
|
Join Date: Jun 2003
Location: Maryland, US
Posts: 268
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Try:
Usage for the Left function:
Left(STRING_HERE, LENGTH_HERE)
__________________
Shane Bauer
Microsoft Certified Professional (MCP) - ASP.NET
ASP/ASP.net, C#, VB/VB.NET, PHP, Perl, SQL
|

08-17-03, 03:03 PM
|
|
ASP Guru
|
|
Join Date: Jun 2003
Location: UK
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks, that worked.
But, I need a little more help.
I'm doing this to get the first two characters of two dates (i.e. they're day), which I can do successfully now.
But, later in my code, I try to subtract one from the other, but I get 'type mismatch' error on the line that performs this arithimatic.
Could you help?
Ta.
|

08-17-03, 03:06 PM
|
|
Coding Addict
|
|
Join Date: Jun 2003
Location: Maryland, US
Posts: 268
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Are you trying to find the difference between two dates? If so, then there is an easier way to do so. ( http://msdn.microsoft.com/library/de...ctdatediff.asp)
But anyway, try converting your variables to integers using:
__________________
Shane Bauer
Microsoft Certified Professional (MCP) - ASP.NET
ASP/ASP.net, C#, VB/VB.NET, PHP, Perl, SQL
Last edited by Shane; 08-17-03 at 03:11 PM.
|

08-17-03, 03:13 PM
|
|
ASP Guru
|
|
Join Date: Jun 2003
Location: UK
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Tried that, still get type mismatch error.
Yeah, I am comparing to dates, but I thought that DateDiff() only worked on SQL Server? I don't have access to that 
|

08-17-03, 03:21 PM
|
|
Coding Addict
|
|
Join Date: Jun 2003
Location: Maryland, US
Posts: 268
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Quote:
Originally posted by Tesco
Tried that, still get type mismatch error.
Yeah, I am comparing to dates, but I thought that DateDiff() only worked on SQL Server? I don't have access to that
|
Nah, you don't need SQL Server. You just have to make sure your two dates are in the form of the Date data type.
This should work....
Also, if you want me to help fix your existing code, please post it so I can see what you are doing.
BTW: this is a great reference.. http://msdn.microsoft.com/library/de...ctdatediff.asp
__________________
Shane Bauer
Microsoft Certified Professional (MCP) - ASP.NET
ASP/ASP.net, C#, VB/VB.NET, PHP, Perl, SQL
|

08-17-03, 03:55 PM
|
|
ASP Guru
|
|
Join Date: Jun 2003
Location: UK
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks Shane, got it working with DateDiff() 
|

08-17-03, 05:37 PM
|
|
Coding Addict
|
|
Join Date: Jun 2003
Location: Maryland, US
Posts: 268
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
__________________
Shane Bauer
Microsoft Certified Professional (MCP) - ASP.NET
ASP/ASP.net, C#, VB/VB.NET, PHP, Perl, SQL
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|