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

Displaying Dates

I have a windows form with several fields. One of the fields is a date. I use
DateTimePicker to enter and format the date. In my SQL table the date si
stored as follows "01/10/2005" and this is what I wont. When I display the
date with a 'fill or select' this is what I get '01/10/2005 12:00'. What am
I doing wrong? Please Help.
--
Norm Bohana
Nov 17 '05 #1
5 1809
Norm,

You are doing nothing wrong. In SQL Server, the time is stored with the
date as well. As a matter of fact, the variable behind the date in your
date time picker has time information as well. However, the date time
picker only displays date information, and it drops the time information (or
rather, it doesn't give it any consideration when displaying it).

They are the same value. The reason you see 12:00 is that the 12:00 is
reflective of midnight on that day, which is technically the first moment of
that day.

Is there an error that you are getting, or is this just a general
concern?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"nbohana" <nb*****@discussions.microsoft.com> wrote in message
news:98**********************************@microsof t.com...
I have a windows form with several fields. One of the fields is a date. I
use
DateTimePicker to enter and format the date. In my SQL table the date si
stored as follows "01/10/2005" and this is what I wont. When I display
the
date with a 'fill or select' this is what I get '01/10/2005 12:00'. What
am
I doing wrong? Please Help.
--
Norm Bohana

Nov 17 '05 #2
I would like to remove the time from the textbox. This what I do in
DateTimePicker!

dateTimePicker1.Format = DateTimePickerFormat.Custom;
dateTimePicker1.CustomFormat = "MM/dd/yyyy";
txtDate.Text = dateTimePicker1.Text;

--
Norm Bohana
"Nicholas Paldino [.NET/C# MVP]" wrote:
Norm,

You are doing nothing wrong. In SQL Server, the time is stored with the
date as well. As a matter of fact, the variable behind the date in your
date time picker has time information as well. However, the date time
picker only displays date information, and it drops the time information (or
rather, it doesn't give it any consideration when displaying it).

They are the same value. The reason you see 12:00 is that the 12:00 is
reflective of midnight on that day, which is technically the first moment of
that day.

Is there an error that you are getting, or is this just a general
concern?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"nbohana" <nb*****@discussions.microsoft.com> wrote in message
news:98**********************************@microsof t.com...
I have a windows form with several fields. One of the fields is a date. I
use
DateTimePicker to enter and format the date. In my SQL table the date si
stored as follows "01/10/2005" and this is what I wont. When I display
the
date with a 'fill or select' this is what I get '01/10/2005 12:00'. What
am
I doing wrong? Please Help.
--
Norm Bohana


Nov 17 '05 #3
Ahh, you didn't mention that you were binding it to a textbox.

When you create the binding, what you can do is subscribe to the Parse
and the Format events on the binding. You can use this to format the date
as you wish in the textbox, as well as parse the date when the text is set
and needs to be persisted back to the value.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"nbohana" <nb*****@discussions.microsoft.com> wrote in message
news:D9**********************************@microsof t.com...
I would like to remove the time from the textbox. This what I do in
DateTimePicker!

dateTimePicker1.Format = DateTimePickerFormat.Custom;
dateTimePicker1.CustomFormat = "MM/dd/yyyy";
txtDate.Text = dateTimePicker1.Text;

--
Norm Bohana
"Nicholas Paldino [.NET/C# MVP]" wrote:
Norm,

You are doing nothing wrong. In SQL Server, the time is stored with
the
date as well. As a matter of fact, the variable behind the date in your
date time picker has time information as well. However, the date time
picker only displays date information, and it drops the time information
(or
rather, it doesn't give it any consideration when displaying it).

They are the same value. The reason you see 12:00 is that the 12:00
is
reflective of midnight on that day, which is technically the first moment
of
that day.

Is there an error that you are getting, or is this just a general
concern?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"nbohana" <nb*****@discussions.microsoft.com> wrote in message
news:98**********************************@microsof t.com...
>I have a windows form with several fields. One of the fields is a date.
>I
>use
> DateTimePicker to enter and format the date. In my SQL table the date
> si
> stored as follows "01/10/2005" and this is what I wont. When I display
> the
> date with a 'fill or select' this is what I get '01/10/2005 12:00'.
> What
> am
> I doing wrong? Please Help.
> --
> Norm Bohana


Nov 17 '05 #4
I am sorry, Thanks much.
--
Norm Bohana
"Nicholas Paldino [.NET/C# MVP]" wrote:
Ahh, you didn't mention that you were binding it to a textbox.

When you create the binding, what you can do is subscribe to the Parse
and the Format events on the binding. You can use this to format the date
as you wish in the textbox, as well as parse the date when the text is set
and needs to be persisted back to the value.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"nbohana" <nb*****@discussions.microsoft.com> wrote in message
news:D9**********************************@microsof t.com...
I would like to remove the time from the textbox. This what I do in
DateTimePicker!

dateTimePicker1.Format = DateTimePickerFormat.Custom;
dateTimePicker1.CustomFormat = "MM/dd/yyyy";
txtDate.Text = dateTimePicker1.Text;

--
Norm Bohana
"Nicholas Paldino [.NET/C# MVP]" wrote:
Norm,

You are doing nothing wrong. In SQL Server, the time is stored with
the
date as well. As a matter of fact, the variable behind the date in your
date time picker has time information as well. However, the date time
picker only displays date information, and it drops the time information
(or
rather, it doesn't give it any consideration when displaying it).

They are the same value. The reason you see 12:00 is that the 12:00
is
reflective of midnight on that day, which is technically the first moment
of
that day.

Is there an error that you are getting, or is this just a general
concern?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"nbohana" <nb*****@discussions.microsoft.com> wrote in message
news:98**********************************@microsof t.com...
>I have a windows form with several fields. One of the fields is a date.
>I
>use
> DateTimePicker to enter and format the date. In my SQL table the date
> si
> stored as follows "01/10/2005" and this is what I wont. When I display
> the
> date with a 'fill or select' this is what I get '01/10/2005 12:00'.
> What
> am
> I doing wrong? Please Help.
> --
> Norm Bohana


Nov 17 '05 #5
Nicholas, I am sorry, I cannot find out how to implement your suggestion. I
found the events ok, but I do not know how to setup it up in the textbox.
Can you point me in the right direction please!!
--
Norm Bohana
"Nicholas Paldino [.NET/C# MVP]" wrote:
Ahh, you didn't mention that you were binding it to a textbox.

When you create the binding, what you can do is subscribe to the Parse
and the Format events on the binding. You can use this to format the date
as you wish in the textbox, as well as parse the date when the text is set
and needs to be persisted back to the value.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"nbohana" <nb*****@discussions.microsoft.com> wrote in message
news:D9**********************************@microsof t.com...
I would like to remove the time from the textbox. This what I do in
DateTimePicker!

dateTimePicker1.Format = DateTimePickerFormat.Custom;
dateTimePicker1.CustomFormat = "MM/dd/yyyy";
txtDate.Text = dateTimePicker1.Text;

--
Norm Bohana
"Nicholas Paldino [.NET/C# MVP]" wrote:
Norm,

You are doing nothing wrong. In SQL Server, the time is stored with
the
date as well. As a matter of fact, the variable behind the date in your
date time picker has time information as well. However, the date time
picker only displays date information, and it drops the time information
(or
rather, it doesn't give it any consideration when displaying it).

They are the same value. The reason you see 12:00 is that the 12:00
is
reflective of midnight on that day, which is technically the first moment
of
that day.

Is there an error that you are getting, or is this just a general
concern?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"nbohana" <nb*****@discussions.microsoft.com> wrote in message
news:98**********************************@microsof t.com...
>I have a windows form with several fields. One of the fields is a date.
>I
>use
> DateTimePicker to enter and format the date. In my SQL table the date
> si
> stored as follows "01/10/2005" and this is what I wont. When I display
> the
> date with a 'fill or select' this is what I get '01/10/2005 12:00'.
> What
> am
> I doing wrong? Please Help.
> --
> Norm Bohana


Nov 17 '05 #6

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

Similar topics

2
by: Russ | last post by:
I've got a report that puts dates at the top of columns and the user is prompted to enter a beginning date when the report is opened. That date is put in a textbox in the first column like this: ...
3
by: Tim Graichen | last post by:
In subFormC, I would like to display only those records that have TrialDate and CompanyCode equal to TrialDate and CompanyCode in subFormB. Can somebody please help me? Thanks Tim
3
by: Lyn | last post by:
I need some guidance for a technique that will allow me to accomplish the following... I have a table in which each record contains a photograph. I would like to display in a form a thumbnail...
9
by: Bosconian | last post by:
I must be having a brain freeze because I can't figure out how to display dates older than 1970. I have birth dates stored in MySQL as "date" data types (exp. 1955-04-06). I'd like to display as...
4
by: jkuruvil | last post by:
I need to print a report of a bunch of records that falls between certain dates. Some records have dates and some don't. I did a UNION query to look for everything that falls between these two dates...
2
by: gubbachchi | last post by:
Hi all, How will I change the color of the dates in the javascript calendar which already has some event entered for it. Like I have a form where the user enters the id and selects the date from...
5
by: sejal17 | last post by:
hello everyone, I have a problem with displaying records between two dates.Below is my designing page: start date: combobox of month(smonth) & combobox of year(syear) end date :...
2
by: ravi | last post by:
hi friends, can we display last ten dates from current system date using sql query. example todays date 19/4/2008 from this last 10 days 18/4/2008 17/4/2008 16/4/2008 ' '
8
by: rjlorenzo | last post by:
Good Day Everyone, Requesting for your expertise please, in my program the user has to enter the agent name and the from date and to date inorder to display the record. I have to use 2 conditions....
1
by: vaibhavideshpandemca | last post by:
How to display the records between 2 dates in ruby on rails I have 2 text boxes where i fill the 2 dates and want to display the records between these 2 dates from the database tables Thanks in...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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,...

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.