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

format for datetimepicker

I am working on a program where I have two datetimepickers and need the difference in days between the two dates. I have the format property for both set to short. When I add the datetimepicker to a label it prints as 12:00:00AM instead of as a date.. How do I format this to return tghe day of the month selected in the picker?

Dim d1 As Date = DateTimePicker1.Value
Dim d2 As Date = DateTimePicker2.Value
totdays = DateDiff(DateInterval.Day, d2, d1)

Thanks for any guidance.
Nov 17 '06 #1
4 1739
Killer42
8,435 Expert 8TB
I am working on a program where I have two datetimepickers ...
The dtpicker would be returning a date variable, and when you print one of those or move to a string, time-only is the default format. The Format() function should do the trick. Just look up the parameters for date/time formats in the online help. Sample:
Expand|Select|Wrap|Line Numbers
  1. Label1.Caption = Format(d1,"d") ' Extract day of month.
Nov 17 '06 #2
I am working on a program where I have two datetimepickers ...
What version of VB are you using?

Maybe you could try:
Expand|Select|Wrap|Line Numbers
  1. totdays = DateDiff("d",d1,d2)
  2.  
Chandra
Nov 17 '06 #3
I am working on a program where I have two datetimepickers ...
Hi,
Better try this..
totdays = d2-d1
if you are using datepicker it works.. else..?
Sep 14 '07 #4
Killer42
8,435 Expert 8TB
Better try this..
Thanks Suresh. This might be a bit late, though. The last message in this thread was in November last year.
Sep 14 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

9
by: Ed Crowley | last post by:
I have a DateTimePicker control on my form that is displaying the date format in UK format (dd/mm/yy). However, in my code dtpStartDate.Value gives a date in US format, but...
7
by: Edward Mitchell | last post by:
I have a number of DateTimePicker controls, some set to dates, some set to a format of Time. The controls are all embedded in dialogs. I created the controls by dragging the DateTime picker from...
2
by: faith | last post by:
Good Afternoon, Does anyone know how to use the customformat in the datatimepicker. I am putting in mm/dd/yyyy and the format does not change. Thanks!
1
by: Rich | last post by:
Hello, I have some datefields in a dataset (ds1). I bind some textbox controls on a windows form to these date fields in ds1, but I only want to see 01/01/2004 instead of 1/1/2004 8:00:00 AM. ...
1
by: Esref Durna | last post by:
my sql server have this datetime format ( yyyy-mm-dd ) how could i change it to dd.mm.yyyy format or what should i do? thanks
14
by: Charles A. Lackman | last post by:
Hello, I an trying to get away from using a Date Time Picker and would like to know how to make a textbox format to a date, i.e. 6604 would be converted to 06/06/04 and if the user type in...
2
by: krishna murthy | last post by:
hi, I have doubt i.e I would like to change the date format.I have used the datetimepicker control in my application.when ever i select by deafault it is giving mm/dd/yyyy but i need the...
3
by: Sam | last post by:
Hi, I store the date selected in a datetimepicker into a sqlserver table in a SmallDateTime field. To be compatible with the date format of my sql server, I convert the date as following: Dim...
4
by: Bill Nguyen | last post by:
I've been reading a confusing guideregarding Datetime format on MSDN. All I need is to get the following output from Datetimepicker value: MM/dd/yyyy 00:00:00 (hh:mm:ss always zero) For...
5
by: Terry | last post by:
My system short date format is dd/mm/yy. The DateTimePicker returns mm/dd/yyyy hh:mm:ss PM. I need to get this value formated into dd/mm/yyyy regardless of the system short date format, what...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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,...

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.