Displaying Date and Time using SimpleDateFormat
I am having trouble displaying the year in a 4 digit format.
My code is as follows:
long measurement;
Calendar TimeStamp = Calendar.getInstance();
SimpleDateFormat TimeStampFormat = new SimpleDateFormat("yyyy:dd:hh:mm:ss");
TimeStamp.setTimeInMillis(measurement);
System.out.print( "\n" + this.getName() + TimeStampFormat.format(TimeStamp.getTime()) + "\t" + Double.longBitsToDouble(measurement));
The display is as follows:
1229798184808538385 38972723:04:10:15:38 Sun Feb 04 22:15:38 EST 38972723
1229798184808538385 38972723:04:10:15:38 Sun Feb 04 22:15:38 EST 38972723
1229798184808538385 38972723:04:10:15:38 Sun Feb 04 22:15:38 EST 38972723
1229798184808538385 38972723:04:10:15:38 Sun Feb 04 22:15:38 EST 38972723
The first column is milliseconds which looks fine, the second column looks like the year is stll displayed in milliseconds, same with column 3.
Any ideas on what the problem is?
Thanks
Your time has too many digits. When I print currentTimeMillis I get
1234028242125
You appear to have the time in nano-seconds.
1229798184808538385
You might get the right time if you divide by a million.
Similar Messages
-
I have checked the box "display date and time on the Menu Bar" and it does not work. Using OS X Yosemite 10.10.2 Anybody have a fix?
Please read this whole message before doing anything.
This procedure is a test, not a solution. Don’t be disappointed when you find that nothing has changed after you complete it.
Step 1
The purpose of this step is to determine whether the problem is localized to your user account.
Enable guest logins* and log in as Guest. Don't use the Safari-only “Guest User” login created by “Find My Mac.”
While logged in as Guest, you won’t have access to any of your documents or settings. Applications will behave as if you were running them for the first time. Don’t be alarmed by this behavior; it’s normal. If you need any passwords or other personal data in order to complete the test, memorize, print, or write them down before you begin.
Test while logged in as Guest. Same problem?
After testing, log out of the guest account and, in your own account, disable it if you wish. Any files you created in the guest account will be deleted automatically when you log out of it.
*Note: If you’ve activated “Find My Mac” or FileVault, then you can’t enable the Guest account. The “Guest User” login created by “Find My Mac” is not the same. Create a new account in which to test, and delete it, including its home folder, after testing.
Step 2
The purpose of this step is to determine whether the problem is caused by third-party system modifications that load automatically at startup or login, by a peripheral device, by a font conflict, or by corruption of the file system or of certain system caches.
Please take this step regardless of the results of Step 1.
Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards, if applicable. Start up in safe mode and log in to the account with the problem. You must hold down the shift key twice: once when you turn on the computer, and again when you log in.
Note: If FileVault is enabled in OS X 10.9 or earlier, or if a firmware password is set, or if the startup volume is a software RAID, you can’t do this. Ask for further instructions.
Safe mode is much slower to start up and run than normal, with limited graphics performance, and some things won’t work at all, including sound output and Wi-Fi on certain models. The next normal startup may also be somewhat slow.
The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
Test while in safe mode. Same problem?
After testing, restart as usual (not in safe mode) and verify that you still have the problem. Post the results of Steps 1 and 2. -
How to display date and time on jsf page
Hi,
how to display date and time on jsf page
we are using 11.2.0.0 jdeveloper on windows.
thanks
Edited by: user12187801 on 26-Jul-2012 01:42Your question is certainly lacking some information.
If you want a constantly updating date/time - then JavaScript is your best bet, and Google would find you examples like [url http://www.webestools.com/scripts_tutorials-code-source-7-display-date-and-time-in-javascript-real-time-clock-javascript-date-time.html]this
If you meant something else, then it's back to you to explain. -
Can we display date and time in a movie
I am filming a production process and would love to be able to display time of day as the video is playing.
I can see this info while editing, but I don't know if iMovie'11 will let me display this info onto the movie itself? I need to pass these clips to someone who doesn't have any editing tools, but they will be interested to review the events on the tape relative to the time of day that they occurred.
It would be cool if iMovie had a title effect that 1) displays time and date info, 2) let's the user edit the format of the displayed date and time, and finally, 3) lets the user move this title information to a location in the tape that won't obstruct the critical elements of the movie.Thanks Appleman 1958!
This helps, but to your point, it doesn't show seconds, and it doesn't show frames (for the video purists out there).
Limited to no more detail than minute data, it is not too useful for me, but I could see this being fun in a fast motion shot.
Also nice for capturing day and time of day information for a vacation video.
For my application, all activity took place in 5 hours, and I would need to see down to the second (and ideally the frame) when specific actions took place.
It would be awesome if Apple would let us
1) edit displayed information (lets say for example turn off date, but show hours minutes seconds and frames)
2) edit the font & font size
3) allow flexible placement of the information window. The default location may be where major action is.
Again, thanks for pointing out this title! -
Problem with getting current date and time using oracle.jbo.domain.Date
I`d like to get current date and time using oracle.jbo.domain.Date method getCurrentDate(), but it always return current date and 12:00:00. I also need to get the current time.
I think you should use java.sql.Timestamp domain.
(And set database type to TIME or DATETIME.)
Jan -
Displaying Date and Time in portal desktop
Hi
I have been looking around for any info or guideline to display the <b>date and time</b> in the portal desktop. I could not find anything very helpfull. In visual admin you can swap lastname and firtsname and vice versa. Thou there is nothing about displaying date and time.
Is it possible to display it and how?
Thank you for any information
NamiraWhere u need the time to be displayed.. If it has to be displayed in Masterhead you can programatically display it...
import the par file for Masterhead, change it and replace it..
Its a simple JSP page so that u can change it easliy..
cheers
gEorgE -
Display date and Time in Oracle Application Express Page
Hi
I have a requirement of showing the date and time in the top left corner of the page which should be updated at all times . The format is DD-MON-YYYY HH24:MI:SS.
I am able to display the date but not the time . Also the time should be updating on its own to the last second.
Another requirement is that on selecting a particular value from the drop down the table values displayed should be filtered
Thanks in advance for helping me out
you can also send in the responses to [email protected]
Regards
Jude FrancoHello,
I am able to display the date but not the time Probably due to your NLS settings not displaying the time component for dates. However you can manually specify the output format like this -
jes@DBTEST> select to_char(sysdate, 'HH24:MI:SS DD-MON-YYYY') as TS from dual;
TS
10:47:45 10-DEC-2008
Another requirement is that on selecting a particular value from the drop down the table values displayed should be filtered Really need more details on that (remember assume that we know nothing about your requirements other than what you tell us). However at a high-level you need to include the drop down value in the query predicate used for your report, for example -
select
e.ename,
e.sal
from
emp e
where
e.deptno = NVL(:P1_DEPTNO, e.deptno)Would use the value from the P1_DEPTNO select list (presumably displaying department names) and use it to filter the result. The NVL is there so that if no dept is selected then the query by default shows all the records.
Hope this helps,
John.
Blog: http://jes.blogs.shellprompt.net
Work: http://www.apex-evangelists.com
Author of Pro Application Express: http://tinyurl.com/3gu7cd
REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone! -
Automatically displaying date and time in a date/time field on form initialize
Good day all;
I am trying to have the current date and time automatically be generated in a “date/time” field when the form is opened.
I went through the forum and found an entry from Srini “ xfa.host.messageBox("" + Date());” . Of course this brought up a system message box with the date and time.
I then tried “DateTimeField1.rawValue = (“”+date())… This also gave me a system message box with the date and time…
Please let me know where I am going wrong
ChompFound the answer... And yes... in was in the "help" section... What can I say I was making it a lot more crazy than I needed to.
You can use a date/time field to automatically show the current date by using the Runtime Property option in the Value tab of the Object palette.
When using a current date field, the date updates to reflect the system’s current date each time a user opens the form.
1.
In the Library palette, click the Standard category and drag a Date/Time Field object onto the form design.
2.
In the Object palette, click the Value tab and select Calculated - Read Only from the Type list.
3.
Select the Runtime Property option.
4.
View the form in the Preview PDF tab. -
Inserting Date AND Time using DBMS_XMLStore.insertXML
Hello,
I'm using a c# app to create an xml file to be passed to a stored procedure. The store procedure then uses DBMS_XMLStore.insertXML to insert the record in the xml file into the database.
There is a field in the Oracle table called "ENTER_DATE". I've been putting a date into the xml file for this field (ie. "10-mar-2010") and this has worked fine. However, I've now been asked to include the time with the date.
Is it possible to somehow put a date AND time value in the xml tag value so that DBMS_XMLStore.insertXML will properly insert it into the Oracle table? Everything I try returns a date picture format error.
ThanksSQL> create table dept2
as
select d.*, sysdate enter_date
from dept d
where 1 = 2
Table created.
SQL> select * from dept2
no rows selected.
SQL> alter session set nls_date_format='dd.mm.yyyy hh24:mi:ss'
Session altered.
SQL> declare
ctx dbms_xmlstore.ctxtype := dbms_xmlstore.newcontext ('dept2');
doc xmltype
:= xmltype('<START>
<ROW>
<DEPTNO>10</DEPTNO>
<DNAME>ACCOUNTING</DNAME>
<LOC>NEW YORK</LOC>
<ENTER_DATE>10.10.2010 23:11:16</ENTER_DATE>
</ROW>
</START>');
ret int;
begin
ret := dbms_xmlstore.insertxml (ctx, doc);
dbms_xmlstore.closecontext (ctx);
end;
PL/SQL procedure successfully completed.
SQL> select * from dept2
DEPTNO DNAME LOC ENTER_DATE
10 ACCOUNTING NEW YORK 10.10.2010 23:11:16
1 row selected. -
How to get server date and time using java code
Hi,
I'm new to java. I have one doubt about getting date and time of the server. can anyone give some sample code to get that.
thanks in regards
Gopi.you need 2 things
1. something on the application server which exposes the servers time/date
2. something on the client which makes use of your time service
for instance, you could write a ServerTimeServlet that clients can call to get the time according to the server. or, if you've got a database in the server, often database software will provide a Time procedure or similar that does this, so you can use a simple SQL query to get the latest time -
Can I print the date and time using aperture 4
Work inspectors require that I provide pictures with date and time of creation from the metadata info. I was looking at google searches and found Aperture with borderFX plug in might work. Can anyone confirm this is a fact? I would hate to pay for the software to find out this feature is not available during export.
BorderFX and Aperture are a great combination for framing and annotating your finished photos. I like to second Frank Caggiano's answer.
I am not sure from your post, if you already have Aperture, so just an add-on: BorderFX works also with iPhoto as an "Export" plug-in.
You can access it in the "File > Export" panel, when saving a photo.
If you do not own Aperture but iPhoto, you can try BorderFX first with iPhoto and see if it will suffice for your purposes. BorderFX is "Donation ware". You can try and explore it freely, before you donate.
BorderFX - iBorderFX iPhoto
An Example: -
Displaying date and time in filename,
hai to all,
i need to take exp dump daily so i prefare to use scheduletask manager but i dont knew how to place the exp dump file name and its logs with their current sysdate and time while exp is taking part.
for example:
exp userid=........... file=d:/new_%date%.dmp log=d:/newlog_%date%.log .................................................
then export gets completed but the dumpfile shows the file name as new_tue.dmp.
it shows only the day but i need full date with its time.
so can anyone help me ,thanks in advance.
regards
ashikHope this may be useful.
make the relvent modification to the below content and save it as .bat file and execute
@echo off
set ORACLE_SID=<your DB SID>
date /T > abc.txt
for /F "tokens=2,3* delims= " %%x in (abc.txt) do echo %%x > abc.txt
for /F "tokens=1* delims=/" %%x in (abc.txt) do set DD=%%x
for /F "tokens=2* delims=/" %%x in (abc.txt) do set MM=%%x
for /F "tokens=3* delims=/" %%x in (abc.txt) do set YY=%%x
for /F "tokens=1* delims= " %%x in ("%YY%") do set ZZ=%%x
del abc.txt
echo FILE=c:\%DD%-%MM%-%ZZ%.dmp>exp.txt
exp <username>/<password> parfile=c:\exp.txt
# just moving the .smp file to another dir.
move %DD%-%MM%-%ZZ%.dmp c:\product\
~
Gidhin KJ
. -
How to get the system date and time using java
hi,
I want system date in my out put. how to access system date. can v use utill packaegs (or) sql. which one is the best to get.
Thanks & Regards,
Kenny.import java.util.Date;
import java.util.Calendar;
import java.util.GregorianCalendar;
public class MyClass {
public void setTimeStamp() {
int hour, minute, second, time = 0;
Date dt=new Date();
System.out.println(dt.getDate());
System.out.println(dt.getMonth());
System.out.println(dt.getYear());
Calendar cal = new GregorianCalendar();
hour = cal.get(Calendar.HOUR_OF_DAY);
minute = cal.get(Calendar.MINUTE);
second = + cal.get(Calendar.SECOND);
System.out.println (hour + ":" + minute + ":" + second);
public static void main (String args[]){
MyClass app = new MyClass();
app.setTimeStamp();
} -
How to display date and time on page
I have the effective date in the database correctly and it shows the date and timestamp of the transacation but only shows the date on the page. How do I get it to show the date and timestamp on the page.
Hello,
If you are talking about a field on a PS page, I had to do something somewhat similar to what you want and what I ended up doing was adding a datetime field (DATETIME1) on the page and on the page peoplecode (activate) I added this following code: Record.DATETIME1.Value = %Datetime;
The Result: 03/25/2015 1:01:54PM
Hope that helps. -
Error in Displaying date and Time in Message - Nok...
Hi,
I have brought a new Nokia 5130 Xpressmusic last month. Now i am facing a problem when i received the message. In the message detail of any message of my inbox the time displayed is 7 to 8 hrs ago the time when i received the message.
For Example
If some body send me a message at 1:00 PM the message detail will show the time 9:00 AM approx....
Any body help me on this....
~Ujjwalmake sure that your time and date settings are correct
for time make sure you have correct time zone - use local or your specific time zone if you prefer
also see if you have automatic time update on or off, if it is on turn it off or if you are using local time you can have it on. see if this helps your issue any
You know what I love about you the most, the fact that you are not me ! In love with technology and all that it can offer. Join me in discovery....
Maybe you are looking for
-
Can't open an iPhoto library, but my wife can from her account
Just reinstalled my system in the last month, but now all of a sudden, I am unable to open our shared iPhoto Library which is stored on a second drive that has no permissions set. But I have no problem accessing the library from my wife's account. An
-
Just starting a J2ME project. An embarrassingly Noobie Question: 1) All the classes that are supposedly "built-in" to my device (phone) do NOT need to be included in the deployed JAR file, right? 2) Anyone know how to do that in Netbeans 5.0? Project
-
How to center text in javafx interface
Hi, first of all, sorry for my bad English... I'm Italian.. :) I'd like to center a Text in a Scene, but I can't. I tried with this code: Text { x: 0 y: 450; font: Font { size: 30 } fill: Color.web("#337799") content: bind "bla bla "; textAlignment:
-
Hi I have installed Xcode command line tools and gfortran package from HPC website. Now, I can't figure what format should I use for input files to compiler. When I used rtf and txt following error occured....... ld: warning: ignoring file u.txt, fil
-
I want to know how many ways Oracles provides Callback mechanism on process level ( e.g. c application ). currently I know: (1)Advanced Queuing (2)Database Change Notification (3)OCI API callback. I'm looking for a fast(real-time) callback mechanism