473,396 Members | 2,010 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Is this an error or intentional?

Just looking up a way to convert dates to Oracle format and found this
function in the forum:

<SCRIPT language="vbscript" runat="server">
Function ConvertToOracleDate(dtmDate)
If IsDate(dtmDate) Then
Dim arData(2)
arData(0) = Right("00" & Day(dtmDate),2)
arData(1) = UCase(MonthName(Month(dtmDate),True))
arData(2) = Year(dtmDate)
ConvertToOracleDate = Join(arData," ")
End If
End Function
</SCRIPT>

It works fine, but I cant understand why this line:

arData(0) = Right("00" & Day(dtmDate),2)

includes the "00" string in the right function. Does it serve some
purpose, or is it a mistake.

TIA,

Colin
Jul 19 '05 #1
1 1181
Because you need a leading zero. So, if the day is 5, the string becomes
005, and you take the right two digits. If the day is 24, it becomes 0024,
and you take the right two digits.

I suppose, really, it could just be a single 0.

--
Aaron Bertrand
SQL Server MVP
http://www.aspfaq.com/


"Colin Steadman" <go****@colinsteadman.com> wrote in message
news:40*************************@posting.google.co m...
Just looking up a way to convert dates to Oracle format and found this
function in the forum:

<SCRIPT language="vbscript" runat="server">
Function ConvertToOracleDate(dtmDate)
If IsDate(dtmDate) Then
Dim arData(2)
arData(0) = Right("00" & Day(dtmDate),2)
arData(1) = UCase(MonthName(Month(dtmDate),True))
arData(2) = Year(dtmDate)
ConvertToOracleDate = Join(arData," ")
End If
End Function
</SCRIPT>

It works fine, but I cant understand why this line:

arData(0) = Right("00" & Day(dtmDate),2)

includes the "00" string in the right function. Does it serve some
purpose, or is it a mistake.

TIA,

Colin

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Wayno | last post by:
My php logs are coming up empty. I have done all I can think of, and all that made sense to me. Can someone take a look at my php.ini please and tell me what you think may be the problem. I...
2
by: Michael . | last post by:
I had an error before involving a temporary table, and that has been taken care of... The last message I wrote where it seemed to have needed it after I added it was because of different...
1
by: ConfuseddotNetnewbie | last post by:
Hi I can't find my other post so please forgive, not intentional. My problem is this when I navigate to an HTML file located in an ASP.NET application directly my error code in global.asax fires...
5
by: Richard | last post by:
I have been struggling with this for days. I feel I must be missing something simple, and I will be eternally grateful for any help. I'm using VS.NET 2003 on XP Pro Sp2. I searched and found...
6
by: Michele Petrazzo | last post by:
Hi list, just found in this moment that my applications stop to work with win xp and receive this error: """ This application has requested the Runtime to terminate it in an unusual way....
10
by: Yahooooooooo | last post by:
Hi, learning c++, can some one check below program. its giving compiler error. #include <iostream> #include <list> using namespace std; typedef list<intListInt;
2
by: mmoeller | last post by:
I'm using an "isInteger" function to test and input. The isInteger function returns a boolean response. If this response is FALSE I would like the Try,Catch,Finally function I'm using to CATCH it....
2
by: Rasika WIJAYARATNE | last post by:
Hi guys, We get the below error on our temple website every 2 hours or so; I think someone is trying to hijack the 'contact.aspx' page somehow to send spam emails, I am not sure though. The...
11
by: kimiraikkonen | last post by:
Hello, I'm very new to C# and just installed VC# 2005 express edition and i have VB 2005 express installed previously. But i saw a thing which may be called as a "Visual C# 2005 express" bug? ...
10
by: =?Utf-8?B?cmFjZTRzcGFjZQ==?= | last post by:
Hi, IIS is not displaying run time errors - the various debugging options (Enable Server Side Debugging, Send Errors to Browser) have been set to true in the IIS console. No Errors are sent to...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.