473,588 Members | 2,621 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how can i get time only in date data type

5 New Member
hey there,
i m trying to get only time information of a date type variable.
i got a column in type of char, it keeps time info in hh:mm format - 5 characters
when i tried to convert it to date with to_date([variable], 'hh24:mi') it gives me a date starts with the ifrst day of current mount, year etc.
01/10/2008 14:04 for example.

i need a solution to get time info in date data type from a char column in hh:mm

thanx for ypur care...
Oct 20 '08 #1
6 11430
amitpatel66
2,367 Recognized Expert Top Contributor
Your requimrent is not clear.Are you trying to convert the char data in to time format or are you trying to extract a time from a current date?
Oct 20 '08 #2
gozdeata
5 New Member
i m trying to convert char data (for example 15:30) into date data type.
to_date('15:30' ,'hh24:mi') function gives it to me with a date that belong to first day of the current mount. for example as 01/10/2008 15:30 i f we cosider today. i need only time info.
thanks for your care...
Gözde
Oct 21 '08 #3
debasisdas
8,127 Recognized Expert Expert
You can store both date a dnd time in a date value .Which can later be extracted as desired for any processing or rerporting purpose.
Oct 21 '08 #4
amitpatel66
2,367 Recognized Expert Top Contributor
i m trying to convert char data (for example 15:30) into date data type.
to_date('15:30' ,'hh24:mi') function gives it to me with a date that belong to first day of the current mount. for example as 01/10/2008 15:30 i f we cosider today. i need only time info.
thanks for your care...
Gözde

Use TO_CHAR(column_ name,'HH24:MI') or TO_CHAR(TO_DATE ('15:30','HH24: MI'),'HH24:MI')
Oct 21 '08 #5
gozdeata
5 New Member
Use TO_CHAR(column_ name,'HH24:MI') or TO_CHAR(TO_DATE ('15:30','HH24: MI'),'HH24:MI')
sorry that i think i couldn't explain my problem clearly
above fınctions gives it to me as character. i need time info in date type. when i use to_date() with 'hh24:mi' it gives me with an unwanted date info. i need only time...
Oct 22 '08 #6
debasisdas
8,127 Recognized Expert Expert
try to use EXTRACT function.
Oct 22 '08 #7

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

Similar topics

1
2621
by: Yong Wang | last post by:
> Hi: > We have a database system. In the database, we have an > attribute called date0, which contains date data (format: > i. e. 2004-08-12). I wrote a script to fetch the data > in a specified time period: > for exaplme: > date1 = raw_input('start date ') > date2 = raw_input('end date ') > > ie. date1 = '2004-08-12'
1
1292
by: John Cosmas | last post by:
I've encountered a table that stores dates in Gregorian format so that the dates and time looks like straight integers that cannot be easily discrened as a date or time by just looking at it. I'm using SQL to query the table and retrieve the data as an integer. I'm tyring to figure out how to best CAST or CONVERT the field into a DATE type so that its readable in the right format. I'm coding in VB.NET and the use of CDATE and FORMAT have...
2
2845
by: Remi Caron | last post by:
Hi, I took over an Visual Object project (Visual Clipper) in that language there is a function to: Convert a string containing a 32-bit binary date to a date data type. That function is called bin2Date and there also is a Date2bin function of course in cannot find how to do this in csharp. The string looks like this "!$%\0" and should return 03/09/52 can somebody point me in the right direction? Have tried Convert class in several ways...
1
4344
by: Alan | last post by:
Any data type that I can use to store date ?
1
1940
by: glenn | last post by:
Hi folks, I am doing an UPDATE to a table that has a field for a DATE data type. I am using MS Access. The UPDATE works fine but when I try to place the DATE field in the mix it blows up. The table name is rfi.
3
1964
by: glenn | last post by:
Hi folks, I have 2 code snippets. One works and one does not. This first hard-coded snippet works Dim queryString As String = "UPDATE SET = '8/16/2006' WHERE (. = @id)" This second snippet does not work
2
3097
by: shubhangi | last post by:
Hi, I want to enter only time from frontend & not date time. Can I do this & can I store this in DB. If yes, what will be data type to store only time values. How do I retrieve the time data in case I want to find difference. Please reply. Thanks Shubhangi
4
1702
by: loisk | last post by:
Hi, I need to compare a date (on a form )entered by a user with today's date and a date should not be greater than today. The problem, however, the data type for the date is string, not date date type. Is there anyway that I can test the user-entered-date against today's date? Thanks!
6
2987
by: dkyadav80 | last post by:
Hi guys, I have a form in html , all description below: first: name of persion (input type box) second: job profile (input type box) third: experience from: list box (Month : Jan, Feb,.. format) and experience to: list box (year: 2008,2007,2006,...) In Mysql database only 4 filed, 1. Name(data type - varchar),
0
7857
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8220
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8352
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
7981
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
6632
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
5723
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
3846
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
3882
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1194
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.