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

date and timestamp storage problems

52
hi,

i have to accept the date and time as inputs from my jsp form and store it in my table.
but,
the problem is that whn i use date datatype it displays time as well.
i want the date data type to accept and display only date
and the timestamp datatype to accept and display only time.
how do i do that?

im using oracle 9i
Mar 12 '07 #1
3 2783
Dave44
153 100+
hi,

i have to accept the date and time as inputs from my jsp form and store it in my table.
but,
the problem is that whn i use date datatype it displays time as well.
i want the date data type to accept and display only date
and the timestamp datatype to accept and display only time.
how do i do that?

im using oracle 9i
what oracle is storing and what you display are two different things. you can store the information in the same field in the table and just select 2 columns with the information that you want. like this:

Expand|Select|Wrap|Line Numbers
  1. [144]dave@ORADB> create table temp (
  2.   2  my_date    date
  3.   3  );
  4.  
  5. Table created.
  6.  
  7. Elapsed: 00:00:00.01
  8. [144]dave@ORADB> insert into temp values (sysdate);
  9.  
  10. 1 row created.
  11.  
  12. Elapsed: 00:00:00.01
  13. [144]dave@ORADB> select to_char(my_date,'mm/dd/yyyy') the_date,
  14.   2         to_char(my_date,'hh:mi:ss am') the_time
  15.   3  from temp;
  16.  
  17. THE_DATE   THE_TIME
  18. ---------- -----------
  19. 03/12/2007 07:23:59 pm
  20.  
  21.  
Mar 13 '07 #2
Hi,
Please tell me
how can i save any TIME rather than server time in table?
Jun 9 '07 #3
debasisdas
8,127 Expert 4TB
In oracle date field takes 7 bytes .

In these 7 bytes oracle stores century,year,month,date,hour,min,sec.

So u can easily store both date and time information to date datatype field.

Again u can also easily retrive what u want to retrive. No need to create separete fields.

As far as time stamp is concerned it stores all the field of date plus fraction of secords upto maximum 9 places (naano second) and default 6 places (micro secord.) This is used for those cases where u need to store time very accurately like some engineering or scientific data.
Jun 11 '07 #4

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

Similar topics

13
by: perplexed | last post by:
How do you convert a user inputted date to a unix timestamp before insterting it into your database? I have a form, with a textfield for a date that the user inputs in the format mm-dd-yyyy and...
2
by: zaceti | last post by:
I'm new to MySQL and I am having a problem selecting the highest valued date/time for a particular day. Here is the table structure: ...
6
by: bryan.seaton | last post by:
I have a delete statement that is not doing what I want it to do: Delete from LOG_TABLE where (DATE(LOG_TS)) < (DATE(CURRENT_DATE)- 21 DAYS); It is supposed to delete all records that are 21...
2
by: Russell Smith | last post by:
Timestamps support infinity. However if appears dates do not. When timestamps are cast to dates, there is no output. Is this an acceptable option or not? Below are a number of examples...
2
by: johndcal | last post by:
Hello All, I have a date value that I pull from a .csv file. After reading the file and storing the values in an array the value of the date could be found in $array, for example....
6
by: Kentor | last post by:
does anyone know of a script that would produce a calendar starting from todays date with checkboxes next to every day of the month so that the user is able to check it in case of an event for that...
10
by: satishrajana | last post by:
Hi, My SQL returns a NULL in a datefield if there is no date in that field. If there is a NULL in this column, I want to replace it with spaces in my SELECT statement when I am selecting these...
0
by: Serious_Practitioner | last post by:
Good day, and Happy New Year! I'm trying to teach myself some PHP and MySQL and the project that I've decided to build will be dependent on queries involving comparisons of dates. I'd like some...
4
by: LouiseR | last post by:
I just recently tried to use a multi-row insert on a table that contains a timestamp column, but I get SQLCODE -180 even though I'm positive that the value that I'm trying to insert is correct. The...
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: 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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.