?
Solved

date Format

Posted on 2004-09-26
7
Medium Priority
?
200 Views
Last Modified: 2010-04-23
hi, i use

alarmDate.Value.Month.ToString() and alarmDate.Value.Day.ToString()

but i only get the dates in this format. 1 instead of 01 do you get what i mean? how can i get them in "01" format?
0
Comment
Question by:stromberg10
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 4

Expert Comment

by:Kaarthick
ID: 12153996
Dim m = lpad(alarmDate.Value.Month.ToString(),2,'0')
Dim d  = lpad(alarmDate.Value.Day.ToString(),2,'0')
0
 

Author Comment

by:stromberg10
ID: 12154003
i got an error
 Dim m = lpad(alarmDate.Value.Month.ToString(),[HERE IT SAYS Expression expexted]2,'0')


I am useing .net framework 2.0 beta. I don't know if that is the problem.
0
 
LVL 4

Expert Comment

by:Kaarthick
ID: 12154064
Try this
Dim m = alarmDate.Value.Month.ToString()
Dim len = m.length
if(len==1)
m="0" & m 'concatenate zero
else
'do nothing

if this works do the same for day value also
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:stromberg10
ID: 12154152
nope it dosen't work.

there is some errors.

Dim len (Variable declaration without an 'As' clause; type of object assumed
Dim m (Variable declaration without an 'As' clause; type of object assumed
0
 
LVL 4

Accepted Solution

by:
Kaarthick earned 200 total points
ID: 12154160
Dim m as String
Dim len as Integer
m =  alarmDate.Value.Month.ToString()
len = m.length
if(len==1)
m="0" & m 'concatenate zero
else
'do nothing
0
 

Author Comment

by:stromberg10
ID: 12154178
it works now. But if a date ar ex 14 it will be 014 and i don't want it to be so. I change == in the if(len==1) to if (len = 1) because the program gave me an error.  Expression expected on == is that why i get 014 instead of 14 if a number are below 10 the funktion works fine.
0
 
LVL 4

Expert Comment

by:Kaarthick
ID: 12154200
Did you check the code by executing it? coz it will concatenate "0" for the value other than 1 to 9 as the length it becomes more than 1.

As you said == is not the problem i guess.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
Well, all of us have seen the multiple EXCEL.EXE's in task manager that won't die even if you call the .close, .dispose methods. Try this method to kill any excels in memory. You can copy the kill function to create a check function and replace the …
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question