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!!! 3 2100
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)
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)
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) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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...
|
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...
|
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.
|
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...
|
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...
|
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
|
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...
|
by: Steven Woody |
last post by:
long i = nnn;
long j;
double d;
d = i;
j = ( long )d;
in this case, i == j ?
thanks.
|
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)
...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
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...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
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...
| |