Date Time Function

G

Guest

Hi! I have a requirement, where in I am saving the events based on certain
date seleceted from the drop down values. Onces saved the data is stored in
database. I have calendar control which highlights the date having events and
onclick on the dates it shows the event details. Its working fine on my
system, but when I sending the same to my client (in UK, who use dd/mm/yyyy
format), it showing worng result. eg. If I have a event on 10th April
(04/10/2006), it showing it as a record for 4th of October(10/04/2006).

How to solve the same.. I am using SQL 200 to store the datas and vb.NET for
code behind coding. I am using VB.NET DateTime function to convert the
Dataset column values to date time

Dim dtStartDate As DateTime
dtStartDate = New DateTime
dtStartDate =
Format(Convert.ToDateTime(tblMonthEvents.Rows(intDayCount).Item("StartDate")), "MM/dd/yyyy")
 
H

Hans Kesting

Hi! I have a requirement, where in I am saving the events based on certain
date seleceted from the drop down values. Onces saved the data is stored in
database. I have calendar control which highlights the date having events and
onclick on the dates it shows the event details. Its working fine on my
system, but when I sending the same to my client (in UK, who use dd/mm/yyyy
format), it showing worng result. eg. If I have a event on 10th April
(04/10/2006), it showing it as a record for 4th of October(10/04/2006).

How to solve the same.. I am using SQL 200 to store the datas and vb.NET for
code behind coding. I am using VB.NET DateTime function to convert the
Dataset column values to date time

Dim dtStartDate As DateTime
dtStartDate = New DateTime
dtStartDate =
Format(Convert.ToDateTime(tblMonthEvents.Rows(intDayCount).Item("StartDate")),
"MM/dd/yyyy")

If that "StartDate" column really is a DateTime value (and not a
varchar
that looks like a date), you can use a straight cast to convert it
to a DateTime.

In C# I would use
dtStartDate = (DateTime)tblMonthEvents.Rows[intDayCount]["StartDate"];

Hans Kesting
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top