Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

date Format

Posted on 2004-09-26
7
Medium Priority
?
201 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
Industry Leaders: 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!

 

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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Suggested Courses

610 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