472,340 Members | 1,815 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,340 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 2318
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...
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...
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...
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 =...
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...
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...
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...
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 "."...
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...
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...
0
by: teenabhardwaj | last post by:
How would one discover a valid source for learning news, comfort, and help for engineering designs? Covering through piles of books takes a lot of...
0
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: CD Tom | last post by:
This only shows up in access runtime. When a user select a report from my report menu when they close the report they get a menu I've called Add-ins...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...

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.