473,379 Members | 1,423 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,379 software developers and data experts.

iCurrent to Double Digits

Hey Guys,

I was wondering if any of you could help me out with converting a single
digit (ie: 1, 2, 3, etc) to double digits (ie: 01, 02, 03, etc).

I am trying to convert the date in DD/MM/YYYY format so it is always
displayed as 01/01/2004 instead of 1/1/2004.

The script I am trying to embed this into has similar attributes to the
Calendar on this site located at http://www.asp101.com/samples/calendar.asp
and the objects that require to be double digits are iCurrent and
Month(dDate).

Thanks Heaps!!!
Jul 19 '05 #1
3 2102
msnews.microsoft.com wrote on 24 aug 2004 in
microsoft.public.inetserver.asp.general:
I was wondering if any of you could help me out with converting a
single digit (ie: 1, 2, 3, etc) to double digits (ie: 01, 02, 03,
etc).

I am trying to convert the date in DD/MM/YYYY format so it is always
displayed as 01/01/2004 instead of 1/1/2004.

The script I am trying to embed this into has similar attributes to
the Calendar on this site located at
http://www.asp101.com/samples/calendar.asp and the objects that
require to be double digits are iCurrent and Month(dDate).


There are many ways to Rome, as the ancient said.
I presume you want vbscript.

<script type="text/vbscript">

Set Response = document '' IE as test environment

function two(x) '' expecting x<=0
two = "" & x
if x<10 then two = "0" & two
end function

function convert(x) '' x=(d)d/(m)m/yyyy [or (m)m/(d)d/yyyy]
a = split(x,"/")
a(0) = two(a(0))
a(1) = two(a(1))
convert = join(a,"/")
end function

Response.write convert("1/1/2004")

</script>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #2
Ok, cool.
So how do I apply that and let it work in the function as follows:

If iCurrent = Day(dDate) Then
Response.Write vbTab & vbTab & "<td background=""mv_today.gif""><b>" &
iCurrent & "</b></td>" & vbCrLf
Else
Response.Write vbTab & vbTab & "<td><a href=""./calendar.asp?date=" &
iCurrent & "/" & Month(dDate) & "/" & Year(dDate) & """>" & iCurrent &
"</a></td>" & vbCrLf
End If

Thanks,

PJ

"Evertjan." <ex**************@interxnl.net> wrote in message
news:Xn********************@194.109.133.29...
msnews.microsoft.com wrote on 24 aug 2004 in
microsoft.public.inetserver.asp.general:
I was wondering if any of you could help me out with converting a
single digit (ie: 1, 2, 3, etc) to double digits (ie: 01, 02, 03,
etc).

I am trying to convert the date in DD/MM/YYYY format so it is always
displayed as 01/01/2004 instead of 1/1/2004.

The script I am trying to embed this into has similar attributes to
the Calendar on this site located at
http://www.asp101.com/samples/calendar.asp and the objects that
require to be double digits are iCurrent and Month(dDate).


There are many ways to Rome, as the ancient said.
I presume you want vbscript.

<script type="text/vbscript">

Set Response = document '' IE as test environment

function two(x) '' expecting x<=0
two = "" & x
if x<10 then two = "0" & two
end function

function convert(x) '' x=(d)d/(m)m/yyyy [or (m)m/(d)d/yyyy]
a = split(x,"/")
a(0) = two(a(0))
a(1) = two(a(1))
convert = join(a,"/")
end function

Response.write convert("1/1/2004")

</script>
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Jul 19 '05 #3
PJ Laurenson wrote on 24 aug 2004 in
microsoft.public.inetserver.asp.general:
"Evertjan." <ex**************@interxnl.net> wrote in message [...]
<script type="text/vbscript">

Set Response = document '' IE as test environment

function two(x) '' expecting x<=0
two = "" & x
if x<10 then two = "0" & two
end function

function convert(x) '' x=(d)d/(m)m/yyyy [or (m)m/(d)d/yyyy]
a = split(x,"/")
a(0) = two(a(0))
a(1) = two(a(1))
convert = join(a,"/")
end function

Response.write convert("1/1/2004")

</script>


[please do not toppost on usenet]
Ok, cool.
So how do I apply that and let it work in the function as follows:

If iCurrent = Day(dDate) Then
Response.Write vbTab & vbTab & "<td background=""mv_today.gif""><b>" &
iCurrent & "</b></td>" & vbCrLf
Else
Response.Write vbTab & vbTab & "<td><a href=""./calendar.asp?date=" &
iCurrent & "/" & Month(dDate) & "/" & Year(dDate) & """>" & iCurrent &
"</a></td>" & vbCrLf
End If


you would need only the Two() function:

.... & two(iCurrent) & "/" & two(Month(dDate)) & ....

btw: PJ, if you had analyzed my code for yourself, you could have found
that out without asking. This is not a criticism, but an inducement to
analyze. And analyze you must, if you are using otherman's code.

====================

some hints:

But why changing the date format in this page as you could do it after
submission in calendar.asp?

Why the ./ which does not add a thing?

Why send the date down to and up from the client and not keep it in a
session variable serverside?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Jul 19 '05 #4

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

Similar topics

0
by: PJ Laurenson | last post by:
Hey Guys, I was wondering if any of you could help me out with converting a single digit (ie: 1, 2, 3, etc) to double digits (ie: 01, 02, 03, etc). I am trying to convert the date in...
3
by: Erik2000 | last post by:
If someone defines a float and double in C++, does that say anything about how many digits the number will hold at maximum and how many places there will be after the decimal point? Or is this...
6
by: J | last post by:
Would anyone know if there a type tag to format a double? I have f for floating point, but cannot find one for double.
5
by: DAVID SCHULMAN | last post by:
I've been trying to perform a calculation that has been running into an underflow (insufficient precision) problem in Microsoft Excel, which calculates using at most 15 significant digits. For this...
14
by: cj | last post by:
VB2003. I need a large positive integer. Which is larger int64 or double? I see int64 also apparently is known as long and will hold -9,223,372,036,854,775,808 through...
60
by: Erick-> | last post by:
hi all... I've readed some lines about the difference between float and double data types... but, in the real world, which is the best? when should we use float or double?? thanks Erick
116
by: Dilip | last post by:
Recently in our code, I ran into a situation where were stuffing a float inside a double. The precision was extended automatically because of that. To make a long story short, this caused...
11
by: Steven Woody | last post by:
long i = nnn; long j; double d; d = i; j = ( long )d; in this case, i == j ? thanks.
206
by: md | last post by:
Hi Does any body know, how to round a double value with a specific number of digits after the decimal points? A function like this: RoundMyDouble (double &value, short numberOfPrecisions) ...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.