473,394 Members | 1,700 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,394 software developers and data experts.

how to get milliseconds

112 100+
I want hr:min:sec:millisecs.
Can someone please tell me DATETIME is the correct type and what should go inside the parantheses.

If i am doing a:
CREATE TABLE startTable
(TIMESTAMP DATETIME()

thanks
Feb 24 '09 #1
8 8963
amitpatel66
2,367 Expert 2GB
Firstly, you cannot use the column name as timestamp because its an oracle keyword.

In detail about timestamp, Check here
Feb 25 '09 #2
ndedhia1
112 100+
I will change the column name to something else but I still was not able to figure out the code that gave me hour, min, sec and milliseconds.

thanks
Feb 25 '09 #3
amitpatel66
2,367 Expert 2GB
Try this:

Expand|Select|Wrap|Line Numbers
  1.  
  2. SQL> ed
  3. Wrote file afiedt.buf
  4.  
  5.   1  select
  6.   2     to_char(systimestamp,'dd-mm-yyyy hh24:mi:ss.FF') as ts,
  7.   3     to_timestamp(
  8.   4        to_char(sysdate,'dd-mm-yyyy hh24:mi:ss.')
  9.   5        ||
  10.   6        to_char(
  11.   7           to_number(
  12.   8              to_char(systimestamp,'FF')
  13.   9           ) + 250),'dd-mm-yyyy hh24:mi:ss.FF'
  14.  10     ) as ts_milliseconds
  15.  11* from dual
  16. SQL> /
  17.  
  18. TS                            TS_MILLISECONDS
  19. ----------------------------- ----------------------------------------------------------------------
  20. 26-02-2009 06:51:09.072583    26-FEB-09 06.51.09.728330000 AM
  21.  
  22. SQL> 
  23.  
  24.  
Feb 26 '09 #4
madankarmukta
308 256MB
@ndedhia1

Hi,

I would suggest you to specify the format in which you want to display the data from the table column while creating the table itself.

Thanks!
Feb 26 '09 #5
ndedhia1
112 100+
I want the display to be:
hour:minute:second:milliseconds

so is this the write syntax?
CREATE TABLE startTable(
ERROR_TIME DATETIME('HH:MM:SS:nnn'));

thanks
Feb 26 '09 #6
amitpatel66
2,367 Expert 2GB
You dont have anything called datetime() in oracle. I think it is in MS SQL server. if you are working with MS SQL then you thread needs to be moved to that forum. Please confirm which database you are using?

If you are using oracle, then getting Millisecond as I suggested in my previous post.You can use that query.
Feb 27 '09 #7
ndedhia1
112 100+
sorry..i have moved the thread over to mysql

thanks
Feb 27 '09 #8
amitpatel66
2,367 Expert 2GB
Thread moved from oracle forum to mysql forum since the question is related to MYSQL DB

Moderator
Feb 28 '09 #9

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

Similar topics

6
by: Richard Visser | last post by:
Hi, i've found this DateRangeSelector : http://www.petrafex.com/view/pgID/21/db/pages/date_range_selector_date_manip ulation__dates_.html . This works fine but i need it to send the dates as :...
2
by: Kevin Thomas | last post by:
Hello, I have a date value in a table SQL Server database that looks like this: 2005-10-11 12:54:36.860 When I load the record into a dataset in VB.NET and retrieve the date value into code,...
11
by: S_at_work | last post by:
hello, can anybody give me a piece of code , or a hint , how i can recieve the time i need for connect() to another host in milliseconds. My problem is i want test the performance of...
9
by: HL | last post by:
I am using VS 2005 Beta - C# Problem: The Timer fires a few milliseconds before the actual Due-Time Let's say a timer is created in the following manner: System.Threading.Timer m_timer = null;...
2
by: Harlin Seritt | last post by:
How can I take a time given in milliseconds (I am doing this for an uptime script) and convert it to human-friendly time i.e. "4 days, 2 hours, 25 minutes, 10 seonds."? Is there a function from the...
2
by: Rajat | last post by:
Hi, I have to draw a real time chart in which I have several entries at the same second (i.e. HH:MM:SS:Milleconds) The charting component only takes julian date for drawing the dates. I am...
13
by: Sharon | last post by:
I need to test a performance of some code of mine. I tried using the Environment.TickCount but its resolution is too low (from the MSDN remarks: The resolution of the TickCount property cannot be...
2
by: vinodtr | last post by:
Hi all, I have a date which is represented by the number of milliseconds since January 01, 1970. I need to change this back to DATE format. Is there any built in function in DB2 to do the needed...
6
by: Manikandan | last post by:
Hi, I need to insert the datetime with milliseconds value into a datarow. My code as below DataTable testDataTable=new DataTable(); testDataTable.Columns.Add("updatedDateTime",...
16
by: Nathan Sokalski | last post by:
I have a control uses the date and time, including milliseconds. I want to be able to enter this information as an attribute in the *.aspx page. Because all attributes are entered as strings in the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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...

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.