473,407 Members | 2,314 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,407 software developers and data experts.

DateTime Format problem

I have a situation where I need to update a table with a time retrieved from a dropdown list.

CODE...

cmd.SqlParameters.Add((@StartTime, SqlDataType.DateTime).Value =
CDate(DropDownList.SelectedItem.Text)

CODE/

While it does update the tabel row with a portion of the data (for ex.. 9/28/2007 12:00:00). I don't need the date part of the data, because all I am interested in is the time. So when the time in the dropdownlist is 4:30:00 pm, I want that time to be retrieved. Any help is appreciated.

Thanks,

Phoenix
Sep 29 '07 #1
5 2427
I have a situation where I need to update a table with a time retrieved from a dropdown list.

CODE...

cmd.SqlParameters.Add((@StartTime, SqlDataType.DateTime).Value =
CDate(DropDownList.SelectedItem.Text)

CODE/

While it does update the tabel row with a portion of the data (for ex.. 9/28/2007 12:00:00). I don't need the date part of the data, because all I am interested in is the time. So when the time in the dropdownlist is 4:30:00 pm, I want that time to be retrieved. Any help is appreciated.

Thanks,

Phoenix
Hi,
Just format the date you retrieved from the dropdownlist using vbscript "FormatDateTime()" function and then update the table.

Let me inform if it does not work.
Thanks
Sep 29 '07 #2
Hi,
Just format the date you retrieved from the dropdownlist using vbscript "FormatDateTime()" function and then update the table.

Let me inform if it does not work.
Thanks
Thanks for responding...

I will try it, but is it in the form...
"FormatDateTime(hh:mm, variable_name)"?

In the meanwhile I tried ...

CODE..

Convert(Datetime,StartTime,108) from TableB

/CODE

.. didn't work. But I will give yours a shot. Let me know the syntax.

Thanks,

Phoenix
Sep 30 '07 #3
Thanks for responding...

I will try it, but is it in the form...
"FormatDateTime(hh:mm, variable_name)"?

In the meanwhile I tried ...

CODE..

Convert(Datetime,StartTime,108) from TableB

/CODE

.. didn't work. But I will give yours a shot. Let me know the syntax.

Thanks,

Phoenix
Hi
The code is;
Expand|Select|Wrap|Line Numbers
  1. FormatDateTime(date, format)
"format" takes parameters: 0, 1, 2, 3, 4.
"3" for hh:mm:ss
"4" for hh:mm
You just choose the parameter you want format your date.
Oct 1 '07 #4
jhardman
3,406 Expert 2GB
...
Phoenix
I thought ASU was in Tempe. Hmm... Pheonix?

Anyway, welcome to the Scripts Developer Network. Notice that there is a button provided (marked - # -) that puts your code within a code block.

Jared
Oct 1 '07 #5
I thought ASU was in Tempe. Hmm... Pheonix?

Anyway, welcome to the Scripts Developer Network. Notice that there is a button provided (marked - # -) that puts your code within a code block.

Jared

Yes, ASU is in Tempe, but I live in Phoenix... about a couple of miles from school.
Oct 1 '07 #6

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

Similar topics

2
by: andrew lowe | last post by:
Hi, Please bear with me on this problem, first I'll give you some background: I have an object that contains a DateTime field which i pass to a webservice public class Foo { public DateTime...
2
by: Sterling Ledet | last post by:
I am trying to create a web service that takes a string from my web server in the following format: Mon, 6 Oct 2003 18:39:47 UTC and put's in a datetime so it can then be reformatted in C# as...
0
by: Ata İsmet Özçelik | last post by:
Hi there, I have a problem with the DateTime picker.. I want to use my custom format; for this I can give a string for the format.But My goal is to have the month name in the box in upper case...
5
by: niju | last post by:
Hi there I am trying to get a single digit hour in 12-hour format with the following code. DateTime hr = DateTime.Now; string hour = hr.ToString("h"); However, I get "Input string was not in...
26
by: Reny J Joseph Thuthikattu | last post by:
Hi, I have a variabe in the format of 'DD-MON-YYYY HH:MI AM' .I want to add a miniute to it.How can i do that? by manipulation i want to make '01-JUNE-2004 11:59 PM' to '02-JUNE-2004 12:00 AM'...
1
by: Ugur Ekinci | last post by:
Hi , I have two Sql Server 2000 on seperate machines , First one accepts datetime format like ("dd.MM.yyyy hh:mm:ss") And Second one accepts datetime format like ("MM.dd.yyyy hh:mm:ss") 1-...
9
by: Simon Harvey | last post by:
Hi all, I'm having a bit of a problem working with dates. My computer is british, but I'm developing an american application so I therefore need to use american dates. But I can't get my...
4
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= | last post by:
Hi I am having a problem formatting a string when the time is in format hh.mm.ss - used in Europe Parse seems ok when the date uses "/" or "." as seperator but I get an exception when time...
11
by: =?Utf-8?B?UGFvbG8=?= | last post by:
I have a SQL database table with rows in which the primary key is a DateTime type (although I don't use the Time part). Have added numerous rows and now want to delete one so I enter the date...
5
by: Sreenivas | last post by:
Hi every one, I need to compare to datetime values , done in stored procedure.The input datetime parameter is in dd/mm/yyyy hh:mm:ss AM/PM format ,the datetime values to be compared are also...
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: 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
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.