Parsing date/time with extra characters
I have a date/time that I would like to parse to make more readable. The original format is like so:
2009-04-26T19:39:00-04:00
This is the date, then 24hr time which is separated by a T, then the time zone. In this case, the time zone is EDT, -4 hours. I have found that I can parse this with something like formatter = new SimpleDateFormat ("yyy-MM-ddTHH:mm:ssZ");This doesn't work, because of the T in the middle I assume. I have also tried
formatter = new SimpleDateFormat ("yyy-MM-dd" + "T" + "HH:mm:ssZ");This doesn't work either. I get a compile error "Illegal patter character 'T'" for both of these. I am about to split the string into two sections, one with date before T, and one with time after T. Before I do this, I was just wondering if there is a cleaner way to do this, using some wildcard possibly?
Try this:
formatter = new SimpleDateFormat(""yyyy-MM-dd'T'HH:mm:ss.SSSZ");{code}
Taken straight from the java docs. Hopefully it'll work.
Edit:
Oops, someone already replied...had the window open too long i guess.
Edited by: sublimeph03nix on Apr 26, 2009 7:46 PM
Similar Messages
-
HI Team,
In ibase component when user change the serial number we need to set date time in Extra attribute filed..if we click edit ,User change serial number after save we need to set date time in Extra Attribute 4 field .
Component - PRDGENSET
In this component there is no attributes,so where we need to implement and how to implement please help.
Thanks
kalpanaHi Abi,
Thanks for your reply..see i debugged..i have put break point in method SET_S_STRUCT method if press enter in serial number ,debuggeris triggered..in SET_S_STRUCT method value getting serial number..so how to write the logic here...
In GET_S_STRUCT method iam getting all attributes but serial number is not filled..So could you please help here what to do..
in set_S_STRCUT method value iam gettin serial number...in collection wrapper iam geting zrealtions if i open attributes_ref -if i pass Attribute value in run time its getting displayed.so how to write the logic based on serial number please help some coding.
Thanks
kalpana -
How to read in date/time with ascii import
I have an ascii data file with a time column in the following format
ddd hh:nn:ss
the seconds are like 11.1234567, so it would look like
234 12:23:11.1234567
I have tried different format options to read this in
with no luck. The data I read in I am then using in CLIP/Insight. The video has this time on it and I need it in the data set to be able to sync them up.The problem with this data format seems to be the 'ddd' at the beginning of the data format.
DIAdem expexts the 'dd' to be a day of a month, not a day in a year. I can offer you a solution though:
Please upload or send me two of your data files and we will create a little script in DIAdem that will import your data format and make it available in DIAdem and DIAdem CLIP.
You can upload them here in the forum or send them to me at:
[email protected]
Please compress the files (with ZIP or similar technology) if they are large.
Otmar
Otmar D. Foehner
Business Development Manager
DIAdem and Test Data Management
National Instruments
Austin, TX - USA
"For an optimist the glass is half full, for a pessimist it's half empty, and for an engineer is twice bigger than necessary." -
Date + time with .dmp file name
I have created a batch file for full db export in Oracle 8.1.7.0.0, the batch file is taking full backup, but I want to append date and time with file name..
Edited by: oracleRaj on Sep 19, 2010 10:25 PMI think example shown by Ramesh above is the correct answer for this thread; as i have just confirmed it too :
C:\Documents and Settings\Girish Sharma>expdp scott/tiger dumpfile=emp_"%date:~7,2%%date:~4,2%%date:~10,4%".dmp tables=emp directory=MYFILES
Export: Release 10.2.0.1.0 - Production on Monday, 20 September, 2010 11:20:17
Copyright (c) 2003, 2005, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
Starting "SCOTT"."SYS_EXPORT_TABLE_01": scott/******** dumpfile=emp_20092010.dmp tables=emp directory=MYFILES
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 64 KB
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "SCOTT"."EMP" 7.773 KB 15 rows
Master table "SCOTT"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
Dump file set for SCOTT.SYS_EXPORT_TABLE_01 is:
D:\CSV\EMP_20092010.DMP
Job "SCOTT"."SYS_EXPORT_TABLE_01" successfully completed at 11:20:37HTH
Girish Sharma -
Logging date/time with measurements put into a spreadsheet
I have a VI set up to receive temperature readings and log them to a spreadsheet. I also want to log the time and date with each reading. How do I do that since the temperature readings are numbers and time/date is a string.
Try using the waveform datatype. This will have the value and a timestamp with each value you take. This can be broken apart to get to each element by using the get waveform components function under the waveform palette. You can convert the timestamp function using the format date/time string function. You also can convert the number to a string. There is a variety of functions under the strings palette. Hope this helps.
BJD1613
Lead Test Tools Development Engineer
Philips Respironics
Certified LV Architect / Instructor -
phone is locked up. turned off and tried tried reset several times, phone displays larger font date/time screen but no slide to unlock control is visible
Try placing the iPod in ecovery mode and then restoring the iPod via iTunes. For recovery mode see:
iPhone and iPod touch: Unable to update or restore
Next would beto wait for the battery to fully drain and the charge and try again. -
How to attach date time with dumpfile name taken with expdp in solaris
I have to write script for daily table backup which would run from crontab in solaris platform on daily basis. I am using expdp for the first time, the following command used to work with EXP
file=/anadbora13/Oracle_Backup/UIBS/dump/inter_UIBS_FM_`date +%d%m%y_%T`.dmp
But,
when I am using the following
dumpfile=inter_UIBS_FM_`date +%d%m%y_%T`.dmp
i am getting error :
ORA-39001: invalid argument value
ORA-39000: bad dump file specification
ORA-39124: dump file name "+%d%m%y_%T.dmp" contains an invalid substitution variable
Pls help....Thanks in advanceHi,
You need to build the parfile commands first (using
server sysdate), and then pass the parfile to
Oracle:
touch /tmp/parfile.txt
Why bother with the 'touch'?
file=/anadbora13/Oracle_Backup/UIBS/dump/inter_UIBS_FM
_`date +%d%m%y_%T`.dmp >> /tmp/parfile.txt
Shouldn't that be 'echo file=.... > /tmp ....'
Why do you show the redirection to append into the temporary command file?
Now, execute the utility. . . .
expdp parfile=/tmp/parfile.txt
To see working details, try Jon Emmon's book "Oracle
Shell Scripting":
http://www.rampant-books.com/book_2007_1_shell_scripti
ng.htm
Hope this helps. . .
Donald K. Burleson
Oracle Press author
Author of "Oracle Tuning: The Definitive Reference":
http://www.dba-oracle.com/bp/s_oracle_tuning_book.htm -
Printed Calender showing time with extra "00"
Don't know if anyone else has this problem but when I print off my calender, it looks like this:
[color code bar] 8:00 00AM Pick up dry cleaning
The extra "00" is weird. It shows up even when the text is set to small. Is it supposed to be showing the end time and it doesn't fit or something?
ThanksActually, I was trying to print the times associated with event in the weekly view. Would you know how to do this? Thx...
-
How can I make the message date appear with the time for unread messages?
Mail systems I am moving from display the date & time with the messages. I need this displayed to determine aging and importance of received mail. When archiving/saving old mail it helps filing mail off and not duplicate archived messages.
Thunderbird displays time and date for all messages except for the present day messages. The time only is displayed for today and the date is appended at midnight.
-
Changing date/time ...
I have a question about changing date and time ... thanks a lot in advance.
I have .CR2 files and I want to change the "date time original" info ... I want to change this info in the raw file, so I clicked on the "write date or time changes to into proprietary raw files" check box in the catalog settings window ... and then, after changing date/time with the "edit capture time", Lightroom wants to save changes and after clicking the arrow on the thumbnail, it creates a sidecar file. If date/time changes is to write directly into raw file (because of catalog settings indicated above), why does Lightroom create sidecar .xmp file?There are two things going on here.
1. When you change the capture date/time (Date Time Original), the change is immediately reflected in the EXIF portion of the Metadata panel in the Library module. Because this is a metadata change, the warning arrow appears on the thumbnail (if you have that set to show in the View Options)....and clicking on that arrow brings up the "Metadata changed, do you want to save to disk" dialog. Note that this happens when you do any kind of metadata change, not just changing the date/time. At that point you can either decide to write the metadata to disk, or not.....if you typically write your metadata changes to XMP I guess you'd say "Save", but if you don't then just ignore it. Of course if you say "Save" then Lightroom will do as requested and write the Metadata, if it's a DNG,JPEG,TIFF etc, the Metadata is written to the XMP section of the file header....but if it's a proprietary RAW then it's written to an XMP sidecar.
2. The second thing is that if you have the option set in the Catalog Settings to write date/time changes into proprietary raw files, then the change that you make is reflected in the Raw file.....this is a different change to the XMP update. -
Parsing date from JSON response
Is there any helper method to parse date time value being returned in JSONResponse to get java.util.Date. For example, 2012-06-26T15:51:59.078-05:00. I have done simple java method using SimpleDateFormat, but that does not handle all possible formats. Anyone has ideas on libraries that can be used for this purpose?
ChandreshOh I see you receive different formats from different services, who's backend you can not modify.
I found this, it should help you get the job done:
http://stackoverflow.com/questions/4024544/how-to-parse-dates-in-multiple-formats-using-simpledateformat
Note however, that his problem is only relatively simplistic, yours on the other hand seems to be one of a kind where you have to be set up a pretty nifty algorithm taking care of all the different possible formats. That being said, there is no method which can parse ANY format you throw at it. you must write one yourself which knows which possible formats to expect.
If its only those two formats you can expect:
2012-06-26T15:51:59.078-05:00
2012-06-26T15:51:59-05:00
it should be an easy try-catch construct within a helper method. just be sure to use the right letters when setting up your SimpleDateFormat parse object, it's case sensitive and one quickly gets lost in all those letters.
Edit:
Again this should do the trick:
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSz");
Just make sure you remove the last ":" from the JSONString (simple string manipulation) and then have two cases
//removing last ":" from JSONString
//====
//Parsing string to date or gregCalendar
GregorianCalendar time= new GregorianCalendar();
try{
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSz");
time.setTime(sdf.parse(JSONString));
catch{
SimpleDateFormat sdf2 = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssz");
time.setTime(sdf2.parse(JSONString));
Edited by: Pascal B on 05.07.2012 04:50
Edited by: Pascal B on 05.07.2012 04:55 -
Checking if Date/Time is Available (and then some more)
Okay, so I am stepping out of my as3 skill set here quite a ways and need some bookoo assistance (Flash 5.5). I am working on trying to come up with a way (an AIR desktop application, or web application) for the teachers on my campus to be able to assign students to a variety of detention types, dates/times with limited seating available. I want the teachers to be able to input the student data and select a date/time or even multiple dates/times, then have the program check to see if there are any available seats remaining for that date/time. If so, assign the student to that seat. If not, display the next available seat's date for that time slot with the option to assign student to that date or choose another.
I also want to be able to run a report that will tell me who is serving which detention, when (date/time) and in what room.
I would also like teachers to be able to "re-assign" a student if they needed to for whatever reason, thus freeing a seat in the previous slot and filling a seat in another.
I'm not quite sure where to start aside from the interface design (that I can easily handle). Does anyone know of a good tutorial (or a few) that could get me on my way to try to code all this?
Thanks!except for making a calendar (http://active.tutsplus.com/tutorials/actionscript/understanding-date-making-a-calendar-in- as3/) there is only logic needed to create that app.
-
Wait Step - Delay in completion - Date/Time specified
Hi Experts,
I've requirement to wait till a specific date/time to reach. For this, I've created a custom method to find out the date/time according to the factory calendar. I'm using a wait statement with option 'Wait for Condition' and condition mentioned comparing the date/time with the system date and time.
But, the completion of wait step is not occurring when the system time reached the specified date/time. It is taking some more time get completed, say 5 to 10 minutes. The condition mentioned in the Wait step is logically correct.
Some of my friends told me that, it depends on the system resources available, but they are not sure.
Can anyone tell me what might be the problem and is there any remedy for this?
Thanks in Advance,
Siva Sankar.It seems that the Report RSWWCOND ss scheduled not on a regular basis.
It should be scheduled every two minutes.
Thanks
Arghadip -
Using FileReader/Writer with Asian Characters - can you spot my problem?
Hi,
I can read in and write out one byte at a time with Asian characters, but if I try to do it one line at a time the Asian output is garbage. I will list both little programs here, and hopefully someone can educate me on my problem.
+++1st, *this {color:#339966}works fine{color} with Asian characters:*+
+{color:#000000}import java.io.*;*{color}+
{color:#000000}class copybyte
public static void main (String args[]) throws IOException
if (args.length != 2)
System.out.println("Usage: java copybyte srcfile dstfile");
return;
final boolean DEBUG=true; // switch for ascii display
int ch; // the buffer{color}
{color:#000000}// Create streams
FileInputStream fis = new FileInputStream (args[0]);
FileOutputStream fos = new FileOutputStream (args[1]);{color}
{color:#000000}while ((ch = fis.read()) != -1)
fos.write(ch);
if (DEBUG)
System.out.print(ch);
System.out.println(" "+Character.toString((char)ch));
fis.close(); fos.close();
}{color}
But the following code outputs Asian characters in garbage to my text file:
{color:#000000}import java.io.;
// Does not seem to handle Japanese....
class CopyLineIO
public static void main (String args[]) throws IOException
if (args.length != 2)
System.out.println("Usage: java copyline srcfile dstfile");
return;
final boolean STRIP=true; //strip blank lines from file ??
String buf,temp;
// Create streams
FileReader fr = new FileReader (args[0]);
FileWriter fw = new FileWriter (args[1]);
BufferedReader br=new BufferedReader(fr); //wrap basic object
BufferedWriter bw=new BufferedWriter(fw); //wrap basic object
while ((buf = br.readLine()) != null)
temp=buf.trim();
if ((temp.length()>0)||(!STRIP)) {bw.write(buf"\n");}
br.close(); bw.close();
fr.close(); fw.close();
Can anyone advise on what to change in CopyLineIO so that Asian characters work?{color} Thanks!
PS Sorry about the code formatting - not sure how to get it looking decent here when pasted in....
Edited by: JavaNeo on Jan 14, 2010 7:10 AM[From the documentation|http://java.sun.com/javase/6/docs/api/java/io/FileReader.html]:
Convenience class for reading character files. The constructors of this class assume that the default character encoding and the default byte-buffer size are appropriate. To specify these values yourself, construct an InputStreamReader on a FileInputStream. To post code use { code } // your code here { code } without the spaces or simple select the code and press the CODE button.
// your code here -
Date Picker with seconds?
Hi everybody,
In my APEX application, for a particular form element, I need to setup a date picker with date + time with seconds.
Unfortunately, in the differents masks that can be used for date picker element, there is not support of seconds.
I have tried to set the default date format at "DD/MON/YYYY HH24:MI:SS" for my application, then to choose the date picker based on the application default date format, but still no support for seconds, only hour and minutes...
Does anyone have an idea about that issue, and a way to implement seconds in my date picker? The point is that I need to be able to select the exact second in a range.
Maybe something with jQuery or something else?
Any help much appreciated!
Thanks,
Romain.Yes, this is one of the solutions, but of course it will require to create these additional elements...
Still looking for an "all-in-one" way. If nothing is possible on the date picker level, I will manage it with more elements.
Thanks,
Romain.
Maybe you are looking for
-
Can I hard wire connect the time capsule to my iMac
I have been told to not use wireless connections when iPhoto library is on external disc. Can I hard wire connect the time capsule external drive. I have found nothing showing or telling me exactly yes or no.
-
ITunes 7.3.1 Totally Stinks!!!!!
Ever since i upgraded to the new iTunes I have a ton of problems. Mainly video podcasts not playing and no content! Apple, PLEASE FIX THESE PROBLEMS!!!!!
-
Best Practices in use of ABAP for SRM and/or CRM Configuration
I was wondering if there is a document that defines best practices for the use of ABAP with the installation and customization of SRM and/or CRM. Such as amount of ABAP coding typically required, and best practices around the use of ABAP for customiz
-
Hi Experts, I am working on SAP ABAP, is it good to learn SAP CRM for future career, basically i am Graduate in Maths & Chemical engg.; working on ABAP for the last 3 years, i am very much interested to switchover to new SAP areas. I am doing my M.B.
-
Macbook won't boot after time machine backup
I installed a program on my Mac that was causing some problems so I decided to do a time machine restore. I booted into recovery mode, selected restore from time machine backup and let it run. It finished completely but it gets stuck at the startup s