Veirfying a String for date
Is there any method by means of which a string can be verified to be a date?
I am using DateFormat but I get the feeling there must be a simpler method
rsaikia
The answer to the first line of your question is YES. But the second line of your question indicates that you already knew that. And no, there isn't a simpler method because people insist in formatting their dates in 73 different ways instead of sticking to a standard way.
Similar Messages
-
Report Designer odbc connection string for data source using a parameter
I am using stand alone report designer 3 for the present and have a question/problem regarding the odbc connection string for MySQL when setting up the data-source
I need to be able to enter a parameter which is the database name i.e. BOE-201401 or say BOE-201312 etc from a list of databases the user can choose from.
at present the odbc connection string points to BOE-201402
the connection string is at present Dsn=Development Server for MYsql;description=MYSQL;server=ldndw01;database=BOE-201402;port=3306
my parameter has the name BOE_DATABASE
and in an expression it is as such
=Parameters!BOE_DATABASE.Value
I want to point the datasource for the report to the parameter value before the user sees the report.Hi Leslie,
Based on your description, we want to design a report with a dynamic DataSource connection string. There are the basic steps below for your reference:
Create report with static database.
Change data source to report parameter.
Send new database connection string as a report parameter.
More detail information, please refer to the following blog: Dynamic Database in SSRS 2008.
http://haseebmukhtar.wordpress.com/2011/11/09/dynamic-database-in-ssrs-2008/
Regards,
Alisa Tang
Alisa Tang
TechNet Community Support -
Generated schema on a query returns xsd:string for date data type
I'm a complete newbie to oracle's xml generation and have encountered the following problem. But first the important details:
select * from v$version
Oracle Database 10g Enterprise Edition Release 10.2.0.2.0 - Prod
PL/SQL Release 10.2.0.2.0 - Production
"CORE 10.2.0.2.0 Production"
TNS for Linux: Version 10.2.0.2.0 - Production
NLSRTL Version 10.2.0.2.0 - Production
We have a large number of dynamic queries that we would like to generate xml for. I'm currently using the dbms_query.getXML(context, 2) to generate the schema definition for the columns as well as the xml row data. Currently, the problem I have is that the schema definition for date columns is being returned as xsd:string rather than xsd:date. I've no idea why it is coming back that way, and haven't found anything to point me in the direction of any configuration data where this can be changed. Here is the table and code I'm using:
query: select dbms_xmlquery.getxml('select * from clh_xml_test',2) from dual
table definition:
create table CLH_XML_TEST
ID NUMBER not null,
NAME VARCHAR2(50) not null,
DATE_COL DATE,
EMAIL_ADDRESS VARCHAR2(100) not null,
URL VARCHAR2(100) not null,
TIMESTAMP_COL DATE
Sample results:
<?xml version="1.0"?>
<DOCUMENT xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="ROWSET">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ROW" minOccurs="0" maxOccurs="unbounded">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="ID" type="xsd:double" minOccurs="0"/>
<xsd:element name="NAME" nillable="true" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="50"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="DATE_COL" type="xsd:string" nillable="true" minOccurs="0"/>
<xsd:element name="EMAIL_ADDRESS" nillable="true" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="100"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="URL" nillable="true" minOccurs="0">
<xsd:simpleType>
<xsd:restriction base="xsd:string">
<xsd:maxLength value="100"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:element>
<xsd:element name="TIMESTAMP_COL" type="xsd:string" nillable="true" minOccurs="0"/>
</xsd:sequence>
<xsd:attribute name="num" type="xsd:integer"/>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<ROWSET xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="#/DOCUMENT/xsd:schema[not(@targetNamespace)]">
<ROW num="1">
<ID>779451193</ID>
<NAME>Clh Test</NAME>
<DATE_COL>1/1/2001 0:0:0</DATE_COL>
<EMAIL_ADDRESS>[email protected]</EMAIL_ADDRESS>
<URL>http://www.google.com</URL>
<TIMESTAMP_COL>7/8/2004 10:7:4</TIMESTAMP_COL>
</ROW>
</ROWSET>
</DOCUMENT>
Thank you for your help, let me know if I can provide any additional information.
Chris
Message was edited by:
user538302use DBMS_XMLGEN.
-
Is there a function that reads a string and can return yes/no if the string matches a specified date format (example: mm/dd/yy)? I wish to avoid parsing the string character by character.
Thanks,
GeorgeBTW,
I used the following example code available from this site. I was able to easily modify it to sovle my problem.
try {
SimpleDateFormat formatter =
new SimpleDateFormat("EEEE, MMMM dd, yyyy");
Date d = formatter.parse(
"Tuesday, January 03, 1956");
formatter = new SimpleDateFormat(
"EE, MMM d, yy");
d = formatter.parse("Tue, Jan 3, 56");
formatter = new SimpleDateFormat(
"EE, MM d, yy");
d = formatter.parse("Tue, 01 3, 56");
process(d);
} catch (ParseException e) {
On to the next challenge...
George -
Incrementing a string number for date and time
There are probably a lot of ways to do this, but I only want to use a bunch of if - else loops if I really need to.
I have a date and time for input, let's say 2006-04-19 22:00. In Java, if I convert that to 3 integers (year, month, day), it will output 2006-4-19. I need to be able to increment in a loop for every day and month from one date to the next. If I keep it as a string, I won't be able to increment the value though, (at least I'm not sure how). I'm thinking that even if I converted it to an integer and back to a string, that the leading zero would be removed.
I found a post here that said something about formatting the number with 2 numbers, by using:
DecimalFormat format = new DecimalFormat("00");
format.format(1, sb, new FieldPosition(0));
Or is there a way to use the gregorianCalendar stuff that would output the date with all of the zeros in place, while incrementing and looping correctly?
Thanks.I would get a Date object--you can use java.text.SimpleDateFormat if you're starting with a String--and use that to create a GregorianCalendar. Then you can just call Calendar's add method to add one to whichever field you want. Use the SimpleDateFormat to turn the date back into a String for display again.
Calculating Java dates: Take the time to learn how to create and use dates
Working in Java time: Learn the basics of calculating elapsed time in Java
Formatting a Date Using a Custom Format
Parsing a Date Using a Custom Format -
Validation For Date,String and Date in a reports Region
Apex 4
Good day to all apex users How do I validate a apex_item.text if the value is string the user can only input a string value if it is number then the user can input numbers only and if it is a date the user can only input a date values?APEX_ITEMS are not part of the default apex gui... In fact they are just functions which returns html.
You can however do some stuff with the attributes parameters. You can find some cool stuff over here: Re: Validation For Date,String and Date in a reports Region
If you want apex validation you need to create a page validation and loop over your apex_items with apex_application.g_f0x
Br,
Nico -
Store Date as Oracle Date as string for simplicity?
I got this table (scaled-down):
CREATE TABLE TBLSERVICES
STORENBR CHAR(4 byte) NOT NULL,
SERVICEDATE CHAR(10 byte) NOT NULL,
CHECKNBR CHAR(6 byte),
ORDER_START_TIME DATE NOT NULL,
ITEMID CHAR(4 byte),
SERVERID NUMBER(18),
SERVERNAME VARCHAR2(50 byte),
ITEMQUANTITY NUMBER
) Function MakeServicesDatatable(byval onodesconfig as xmlnodelist) return datatable
dim objDT as new datatable
With objDt
.Columns.Add("StoreNbr", GetType(String))
.Columns.Add("Order_Start_Time", GetType(String))
End With
dim dte as string
For Each onode As XmlNode In onodesConfig
If onode.InnerText = "5" Or onode.InnerText = "6" Then
objdr = objDt.NewRow
objdr("StoreNbr") = storenbr
dteYear = parentNode("Order_Start_Time").SelectSingleNode("Year").InnerText
dteMonth = parentNode("Order_Start_Time").SelectSingleNode("Month").InnerText
dteDay = parentNode("Order_Start_Time").SelectSingleNode("Day").InnerText
DteHour = parentNode("Order_Start_Time").SelectSingleNode("Hour").InnerText
dteMin = parentNode("Order_Start_Time").SelectSingleNode("Minute").InnerText
dteSecs = parentNode("Order_Start_Time").SelectSingleNode("Second").InnerText
dte = String.Format("{0}/{1}/{2} {3}:{4}:{5}", dteMonth, dteDay, dteYear, DteHour, dteMin, dteSecs)
objDR("order_start_time") = dte
objDt.rows.add(objdr)
end if
next onode
return objDT
end function
I call following:
dt = MakeServicesDatatable(NodesWithData)
WriteDataToDB(dt)
Public Sub WriteDataToDB(ByVal dtServices As DataTable)
Dim altConnString As String = connString
Dim queryString As String = "Select * from tblServces"
Using connection As New OracleConnection(altConnString)
Dim adapter As New OracleDataAdapter()
adapter.SelectCommand = New OracleCommand(queryString, connection)
Dim builder As OracleCommandBuilder = New OracleCommandBuilder(adapter)
connection.Open()
Dim ds As DataSet = New DataSet
adapter.Fill(ds, "tblServices")
For Each drService As DataRow In dtServices.Rows
ds.Tables("tblServices").ImportRow(drService)
Next drService
adapter.Update(ds, "tblServices")
End Using
End SubIn a PL/SL SQL Query, I need to say something like this:
- Lunch is anything before 3:00pm
- Assume date is same as date of order start time
select storenbr,
itemquantity
from tblServices
where order_start_time < DatePArt(order start time date) || 15:59:00 I don't know syntax for getting date portion of oracle date
Problem is the order_start_time is stored as dd-mmm-yyyy.
I need seconds also. Should I make order-start_time a string
and convert to date in SQL statement.Hi Vinod,
Create a varaible of type customer exit for RUNDATE.
IF i_step = 1.
select max (rundate) from /bic/prundate into zrundate.
IF i_vnam = 'rundate'.
l_s_range - low = zrundate.
l_s_range- opt = 'eq'.
append l_s_range into e_t_range.
endif.
Endif.
hope it helps
bhaskar -
Hi specialist's,
i have a simple question about a select, but I think I do not see the forrest becaus of too many trees ...
I have a table where timestamps are stored in seconds-since-epoch.
I select a human readble format with this statement:
select to_char(DATE '1970-01-01' + TRXTIMESTAMP / (24*3600*1000), 'DD-MM-YYYY HH24:MI:SS') as timestamp from txlog;
TIMESTAMP
19-10-2013 09:31:27
19-10-2013 09:31:27
19-10-2013 09:31:27
Now I want to filter i.e. for dates of 19-01....
My first try was this:
select to_char(DATE '1970-01-01' + TRXTIMESTAMP / (24*3600*1000), 'DD-MM-YYYY HH24:MI:SS') as timestamp from txlog
where timestamp like '19-%'
Result:
ORA-00904: "TIMESTAMP": invalid identifier
My next try was this:
select to_char(DATE '1970-01-01' + TRXTIMESTAMP / (24*3600*1000), 'DD-MM-YYYY HH24:MI:SS') as timestamp from txlog
where 1 like '19%'
Result: 0 rows!
If I change this to
... where 1 like '%'
I get all rows.
What is wrong with my selects ???Felix_GG wrote:
Hi specialist's,
i have a simple question about a select, but I think I do not see the forrest becaus of too many trees ...
I have a table where timestamps are stored in seconds-since-epoch.
I select a human readble format with this statement:
select to_char(DATE '1970-01-01' + TRXTIMESTAMP / (24*3600*1000), 'DD-MM-YYYY HH24:MI:SS') as timestamp from txlog;
TIMESTAMP
19-10-2013 09:31:27
19-10-2013 09:31:27
19-10-2013 09:31:27
Now I want to filter i.e. for dates of 19-01....
My first try was this:
select to_char(DATE '1970-01-01' + TRXTIMESTAMP / (24*3600*1000), 'DD-MM-YYYY HH24:MI:SS') as timestamp from txlog
where timestamp like '19-%'
Result:
ORA-00904: "TIMESTAMP": invalid identifier
My next try was this:
select to_char(DATE '1970-01-01' + TRXTIMESTAMP / (24*3600*1000), 'DD-MM-YYYY HH24:MI:SS') as timestamp from txlog
where 1 like '19%'
Result: 0 rows!
If I change this to
... where 1 like '%'
I get all rows.
What is wrong with my selects ???
Firstly, why not store timestamps as timestamps?
Anyway, Your first select refers to the alias 'timestamp' which is only accessible in an outer query, not from within the where clause.
Try
Select * from (
select to_char(DATE '1970-01-01' + TRXTIMESTAMP / (24*3600*1000), 'DD-MM-YYYY HH24:MI:SS') as timestamp from txlog
where timestamp like '19-%';
But timestamp is not a good choice for an alias, as it is a keyword.
Your second select is obvious - the number 1 will never be like '19%', but it will work
in the third select: as 1 is indeed like '%' (anything). -
Help with today's date - 2 days as a string for a file name
This will be an Expression/Connection String for a Flat File Connection Manager.
Need it in this format COMPANY20150402.txt except the formula needs to incorporate the DATEADD("D", -2, Getdate())
"COMPANY" + (DT_STR,4,1252) DatePart("yyyy",getdate()) +
Right("0" + (DT_STR,4,1252) DatePart("m",getdate()),2) +
Right("0" + (DT_STR,4,1252) DatePart("d",getdate()),2) +".txt"
Where do I add the DATEADD part? and be syntactically correct?
TIA
HarryYou do get COMPANY20150402.txt outputted from your expression
just keep adding DATEADD("DAY",-2,.... to each getdate()
like
"COMPANY" + (DT_STR,4,1252) DatePart("yyyy",DATEADD("DAY",-2,getdate())) +
Right("0" + (DT_STR,4,1252) DatePart("m",getdate()),2) +
Right("0" + (DT_STR,4,1252) DatePart("d",getdate()),2) +".txt"
Arthur
MyBlog
Twitter -
Revision: 11030
Author: [email protected]
Date: 2009-10-20 11:35:02 -0700 (Tue, 20 Oct 2009)
Log Message:
Tweak the deserialization of ASObjects to treat an empty string for the type of an object as null. It appears that there is some logic in the LC remoting code that relies on a non-null class name to always exist. This change reverts to the old behavior of not allowing empty string as a value for the ASObject.namedType.
This should fix bug 2448442 and its duplicates caused by the recent serialization changes.
I don't think this is the perfect fix. Pending further investigation, a better fix would be either:
a. If it's OK to assume that empty string should always mean null for the type of the ASObject, the code that enforces it should be in the setter/getter inside ASObject and not in the deserializer.
b. ASObject doesn't guarantee that a named type exists or is valid. In that sense an empty string is as bad as some random characters that cannot be a valid class name in java, so depending on how disruptive it may be, the fix should be in any logic that uses ASObject.getType().
Modified Paths:
blazeds/trunk/modules/core/src/flex/messaging/io/amf/AbstractAmfInput.javaHi Pavan,
"In your payload there is no namespace prefix for the elements under PayloadHeader element."
Yes, you are right - but this message is standard AQ Adapter Header message - it's not defined by me. I just used message which was automatically added to my project when I have defined AQ Adapter.
"In your process is the default namespace is same as namespace value of tns ??"
Do you mean targetNamespace? If yes it's different as it points to process "targetNamespace="http://xmlns.oracle.com/PF_SOA_jws/PF_APPS/APPS_PROCESS" (names of application and process have changed as I try different ways to do that)
ns1 is: xmlns:ns1="http://xmlns.oracle.com/pcbpel/adapter/aq/PF_SOA/PF_APPS/PO_AQ"
"another thing is tns and ns1 should have same values.."
When I create a variable of header type, namespace ns1 is automatically created for it. I set it as property of receive activity. When process is instantiated on the serwer I get the error in which you can see that namespace is tns.
Maybe I'm doing something wrong but I don't see how I could fix this in my process.
You can see that the message I get on the server has nothing in common with the application/project/process names. Is it possible to define such variable?
Regards
Pawel
PS:
In Transformation xsl file, both variables (source and target) has tns namespace for Header and PayloadHeader, and no namespace for subfields.
Edited by: pawel.fidelus on 2010-01-05 02:37 -
Function Modules for Data and Time
Hi all,
I need 2 function modules for date and time. when we pass current data(sy-datum) and current time (sy-uzeit) into function modules, shoud get date in <b>dd/mm/yyyy or dd.mm.yyyy</b> and time in<b> HH:MM:SS</b> formats.
Thanks in advanceHi Ranjith,
i think this will b usefull for you..
SAP Bar Chart Function Modules and what they are used for
Function module
Used for
BARC_GRAPHIC_PBO
Starting bar chart at PBO time, using a graphic profile (parameter PROFILE)
BARC_GRAPHIC_PAI
Analyzing data returned by the graphic
BARC_SET_TIME_AXIS
Setting start and end of time axis
BARC_SET_OPTIONS
Setting options
BARC_ADD_CHART
Creating a chart
BARC_SET_CHART_ATTRIB
Setting chart attributes
BARC_ADD_SECTION
Creating a section on the time axis
BARC_SET_SECTION_ATTRIB
Setting section attributes
BARC_ADD_RIBBON
Adding a ribbon to the time axis
BARC_SET_RIBBON_ATTRIB
Setting attributes for ribbons in the chart
BARC_ADD_GRID
Adding a time grid
BARC_SET_GRID_ATTRIB
Setting grid attributes
BARC_ADD_LAYER
Adding a layer (graphic elements)
BARC_SET_LAYER_ATTRIB
Setting layer attributes
BARC_ADD_LINE
Adding a line
BARC_ADD_CALENDAR
Creating a calendar
BARC_SET_CALENDAR_ATTRIB
Setting attributes for a calendar
BARC_ADD_TIME_PROFILE
Creating time profiles
BARC_SET_TIME_PROFILE_ATTRIB
Setting attributes for time profile
BARC_ADD_INTERVAL
Adding a time interval
BARC_SET_INTERVAL_ATTRIB
Setting time interval attributes
BARC_ADD_TIME_OBJECT
Creating a time object
BARC_CONVERT_DATE
Creating a date string in bar chart format
BARC_REVERT_DATE
Converting a date string in bar chart format to date and time
BARC_ADD_DATELINE
Creating a date line
BARC_SET_DATELINE_ATTRIB
Setting dateline attributes
BARC_GET_PROFILE_CONTENTS
Obtaining profile contents for customizing a chart
BARC_GET_COLUMN_WIDTH
Selecting new column width
BARC_SET_COLUMN_WIDTH
Setting the column width
BARC_GET_TEXTINDEX
Obtaining the text index of a field
BARC_SET_LABELS
Positioning the chart display
BARC_SET_COLUMN_ATTRIB
Setting column attributes
BARC_SET_ROW_ATTRIB
Setting row attributes
BARC_SET_ROW_HEIGHT
Setting the line height
BARC_SET_MAXCHARTS
Setting the maximum number of charts sent
<b>If its usefull reward points
</b> -
Hi Friends,
I Have a view named - item_sales with 4 column
Item code
Item name
Transaction_YYYYMM (Date stored in YYYYMM format )
QTY_RECEIVED
QTY_SOLD
Sample data is
ITEM_CODE ITEM NAME TRANSACTION_YYYMM QTY_RECD QTY_SOLD
AX TSHIRT 201307 3000 2000
AX TSHIRT 201308 2000 500
AX TSHIRT 201309 1000 3000
CX XLSHIRT 201307 3000 2000
CX XLSHIRT 201308 3000 2500
CX XLSHIRT 201309 3000 2500
EVERY MONTH END I WILL RUN THIS QUERY TO FIND OUT THE BELOW DETAILS
1. TO FIND ITEM_NAME WISE - QTY_RECEIVED AND QTY_SOLD ( FOR CURRENT MONTH - EXAMPLE SEP )
2. TO FIND ITEM_NAME WISE - QTY_RECEIVED AND QTY_SOLD (FOR CURRENT YEAR EXAMPLE FROM JAN TO SEP )
OUTPUT FOR SEPTEMBER MONTH LOOK LIKE THIS
SEP-MONTH JAN TO SEP
ITEM_CODE ITEM_NAME QTY_RECEIVED QTY_SOLD QTY_RECEIVED QTY_SOLD
AX TSHIRT 1000 3000 6000 5500
CX XLSHIRT 3000 2000 9000 7000
Pls advise me how to write queries for this
RdkJust FYI, you *can* edit your own posts, you know
Rdk wrote:
Transaction_YYYYMM (Date stored in YYYYMM format )
First "problem". Don't store dates as string. Store them as dates. It will save you so much headache don't the road you won't believe it.
True, this is a view, so maybe not as critical - assuming the underlying *DATA* is actually a date.
1. TO FIND ITEM_NAME WISE - QTY_RECEIVED AND QTY_SOLD ( FOR CURRENT MONTH - EXAMPLE SEP )
2. TO FIND ITEM_NAME WISE - QTY_RECEIVED AND QTY_SOLD (FOR CURRENT YEAR EXAMPLE FROM JAN TO SEP )
So yeah, based on these requirements, I'd recommend you make that column a DATE, not a string. Dates are easier to parse for date-related logic - such as month by month as you need here.
Using that, here's one way to do it:
with w_data as (
select 'AX' item_code, 'TSHIRT ' item_name, to_date('20130701','yyyymmdd') trans_dt, 3000 qty_recd, 2000 qty_sold from dual union all
select 'AX' , 'TSHIRT ' , to_date('20130801','yyyymmdd') , 2000 , 500 from dual union all
select 'AX' , 'TSHIRT ' , to_date('20130901','yyyymmdd') , 1000 , 3000 from dual union all
select 'CX' , 'XLSHIRT' , to_date('20130701','yyyymmdd') , 3000 , 2000 from dual union all
select 'CX' , 'XLSHIRT' , to_date('20130801','yyyymmdd') , 3000 , 2500 from dual union all
select 'CX' , 'XLSHIRT' , to_date('20130901','yyyymmdd') , 3000 , 2500 from dual
w_base as (
select item_code, item_name, trans_dt, qty_recd, qty_sold,
sum(qty_recd) over (partition by item_code, trunc(trans_dt, 'MM')) mm_recd,
sum(qty_sold) over (partition by item_code, trunc(trans_dt, 'MM')) mm_sold,
sum(qty_recd) over (partition by item_code, trunc(trans_dt, 'YY')) yy_recd,
sum(qty_sold) over (partition by item_code, trunc(trans_dt, 'YY')) yy_sold,
row_number() over (partition by item_code order by trans_dt desc) rnum
from w_data d
Select item_code, item_name, mm_recd, mm_sold, yy_recd, yy_sold
from w_base
where rnum = 1
IT ITEM_NA MM_RECD MM_SOLD YY_RECD YY_SOLD
AX TSHIRT 1000 3000 6000 5500
CX XLSHIRT 3000 2500 9000 7000 -
Convert String to Date and Format the Date Expression in SSRS
Hi,
I have a parameter used to select a month and year string that looks like: jun-2013
I can convert it to a date, but what I want to do is, when a user selects a particular month-year (let's say "jun-2013")
I populate one text box with the date the user selected , and (the challenge Im having is) I want to populate a text box next to the first text box with the month-year 2 months ahead. So if the user selects
jun-2013 textbox A will show jun-2013
and textbox B will show aug-2013..
I have tried:
=Format(Format(CDate(Parameters!month.Value ),
"MM-YYYY" )+ 2 ) -- But this gives an error
This returns the month in number format like "8" for august...
=Format(Format(CDate(Parameters!month.Value ),
"MM" )+ 2 )
What is the proper syntax to give me the result in this format = "aug-2013" ???
Thanks in advance.
MC
M CollierYou can convert a string that represents a date to a date object using the util.scand JavaScript method, and then format a date object to a string representation using the util.printd method. For more information, see:
http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.1254.html
http://livedocs.adobe.com/acrobat_sdk/9.1/Acrobat9_1_HTMLHelp/JS_API_AcroJS.88.1251.html
In your case, the code would be something like:
var sDate = "2013-01-10";
// Convert string to date
var oDate = util.scand("yyyy-mm-dd", sDate);
// Convert date to new string
var sDate2 = util.printd("mm/dd/yyyy", oDate);
// Set a field value
getField("date2").value = sDate2;
The exact code you'd use depends on where you place the script and where you're getting the original date string, but this should get you started. -
Regarding conversion of String to Date
Hi
Ravi here and I am getting the following exception when i am working with String to date conversion.As i am working in LAN this code is working for all others .This problem is with my system only.This is not supporting with yyyy-MM-dd format.One more thing in my system only we installed VisualStudio.Is that a problem for this exception.I am using Myeclipse
Plzzzzzzzzzzz help me I got strucked .
Thanks in advance
Code:
public void testSaveDates() throws HibernateException, ParseException{
try{
Date date=new Date();
String str1 ="2006-05-06";
Date dateFormatter = new SimpleDateFormat("yyyy'-'MM'-'dd").parse(str1);;
System.out.println(dateFormatter);
catch(Exception e){
e.printStackTrace();
Exception:
java.text.ParseException: Unparseable date: "2006-05-06"
at java.text.DateFormat.parse(DateFormat.java:335)
at chaitanya.MyTest.testSaveDates(MyTest.java:282)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:421)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:305)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:186)Date date=new Date();You don't need this line.
Date dateFormatter = new
er = new
SimpleDateFormat("yyyy'-'MM'-'dd").parse(str1);;As already told, you don't need the single quotes. And you don't need two semi-colons - that's unnecessary.
I just wrote a sample code to test that out. Check it and see for yourself.
import java.text.SimpleDateFormat;
public class Test {
public static void main(String[] args) throws Exception {
System.out.println(new SimpleDateFormat("yyyy-MM-dd").parse("2005-04-18"));
System.out.println(new SimpleDateFormat("'yyyy'-'MM'-'dd'").parse("2005-04-18"));
}Output:
Mon Apr 18 00:00:00 EDT 2005
Exception in thread "main" java.text.ParseException: Unparseable date: "2005-04-18"
at java.text.DateFormat.parse(DateFormat.java:335)
at Test.main(Test.java:6)I wonder why it is not feasible to write a quick sample code. -
Revision: 3519
Author: [email protected]
Date: 2008-10-08 04:17:40 -0700 (Wed, 08 Oct 2008)
Log Message:
Fix typo in error string for situations where there are advanced messaging configuration settings from LCDS used in the configuration files but no AdvancedMessagingSupport service. The error string said that there was no flex.messaging.services.AdvancedMessagingService registered but it is the flex.messaging.services.AdvancedMessagingSupport service that needs to be registered.
Add configuration test that starts the server with a destination that has the reliable property set which is an advanced messaging feature but there is no AdvancedMessagingSupport service registered.
Modified Paths:
blazeds/trunk/modules/common/src/flex/messaging/errors.properties
Added Paths:
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/messagingService/ReliableDestina tionWithNoAdvancedMessagingSupport/
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/messagingService/ReliableDestina tionWithNoAdvancedMessagingSupport/error.txt
blazeds/trunk/qa/apps/qa-regress/testsuites/config/tests/messagingService/ReliableDestina tionWithNoAdvancedMessagingSupport/services-config.xmlHi,
Unfortunately I already tried all kinds of re-installs (the full list is in my original message). The only one remaining is the reinstall of Windows 8 itself, which I would really like to avoid.
What I find really strange is the time it takes for the above error message to appear. It's like one hour or even more (never measured exactly, I left the computer running).
What kind of a timeout is that? I would expect that, if ports are really used by some other application, I get the message in less than a minute (seconds, actually). To me this looks like the emulator itself for some reason believes there's a problem with
some port while in reality there isn't.
I'll eventually contact Microsoft Support, thanks for the suggestion.
▼
▲
Maybe you are looking for
-
hi could you please run this script: set myindi=createobject("InDesign.Application") set mydoc=myindi.activedocument for a=1 to 10 set myLine = mydoc.pages.item(1).graphiclines.add myline.geometricbounds = array(0,50,200,a*10) next (I think c
-
HT2534 why they didnt ask me for a credit card when i set up my apple id
Why they didnt ask me for a credit card.when i set up my apple id.
-
How to rotate a graphic in Keynote
How do you rotate a graphic? After selecting it, I try placing the cursor around the sides expecting to be able to rotate it like in Photoshop, though it does not work.
-
How can I sign out or remove the old apple ID in app store's updates?
I created a new apple id and signed in the app store. When I update my apps, it requires me to sign in with my old apple id, and I cannot sign out my old id. How can I sign out or remove the old id in app store's updates?
-
What is excatly the fastpath of function codes in pf-status
Hi friends, I would like to know what is excatly the fastpath of function codes in pf-status. I thought at first that I can choose a letter and in my program press Alt+letter and the function code will be executed but it did not work for me. Please h