Date in incorrect format
Hi,
I have one program which creates variant.The variant date created by the program is wrong 1//20/05/2.
What would be the issue?
As per my knowledge, we get this error because we pass date to an internal table in MM/DD/YYYY format instead of YYYYMMDD. Usually programs take YYYYMMDD format and displays the output in MM/DD/YYYY. But i am not finding any such case here in the program to solve the issue.
*convert date yyyymmdd to mm/dd/yyyy
concatenate itab-process_date+4(2)
itab-process_date+6(2)
itab-process_date(4)
into it_fin-doc_dt separated by '/'.
hope this will help u
regards,
PP
Similar Messages
-
On our build system, we use the global setting to code analyze all projects. One of our projects is a C# WIX custom action. This projects causes the build to fail with:
EACustomInstallActions.CA.dll' could not be opened -- 'An attempt was made to load a program with an incorrect format.
The ...CA.Dll target seems to be created by a WIX custom action. Does anybody have already encountered this issue and found a workaround?
Full build output:
<target name="ContractDeclarativeAssemblyCS" success="false">
<message level="normal"><![CDATA[Build Declarative Contract Assembly for C# D:\EA_MAIN_DB\AMI\bin\Debug\GEHealthcare.Isip.EACustomInstallActions.dll]]></message>
<message level="high"><![CDATA[C:\Windows\Microsoft.NET\Framework\v3.5\Csc.exe /noconfig /nowarn:1701,1702 /pdb:obj\x86\Debug\Decl\GEHealthcare.Isip.EACustomInstallActions.pdb /errorreport:prompt /warn:0 /define:DEBUG;TRACE;CONTRACTS_FULL;CODE_ANALYSIS /reference:"C:\Program Files\Windows Installer XML v3\SDK\Microsoft.Deployment.WindowsInstaller.dll" /reference:"C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.ConnectionInfo.dll" /reference:"C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Management.Sdk.Sfc.dll" /reference:"C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.Smo.dll" /reference:"C:\Program Files\Microsoft SQL Server\100\SDK\Assemblies\Microsoft.SqlServer.SqlWmiManagement.dll" /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll" /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Data.DataSetExtensions.dll" /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Data.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Drawing.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Windows.Forms.dll /reference:C:\Windows\Microsoft.NET\Framework\v2.0.50727\System.Xml.dll /reference:"C:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Xml.Linq.dll" /addmodule:D:\EA_MAIN_DB\AMI\src\radstore\Installer\EACustomInstallActions\obj\x86\Debug\GEHealthcare.Isip.EACustomInstallActions.CA.dll /debug+ /debug:full /filealign:512 /keyfile:..\..\Common\EAKeyPair.snk /optimize+ /out:obj\x86\Debug\Decl\GEHealthcare.Isip.EACustomInstallActions.dll /target:library /warnaserror- ..\..\Common\GlobalAssemblyInfo.cs CustomAction.cs Properties\AssemblyInfo.cs Resource1.Designer.cs SqlServersSelector.cs SqlServersSelector.designer.cs "C:\Program Files\Microsoft\Contracts\Languages\CSharp\ContractDeclarativeAssemblyAttribute.cs"]]></message>
<error code="CS0009" file="CSC"><![CDATA[Metadata file 'd:\EA_Main_DB\AMI\src\radstore\Installer\EACustomInstallActions\obj\x86\Debug\GEHealthcare.Isip.EACustomInstallActions.CA.dll' could not be opened -- 'An attempt was made to load a program with an incorrect format. ']]></error>
</target>This problem appears to be ongoing 5 years after this thread was started. I have just run into it.
When WiX builds a custom action, the build proceeds as normal and produces a managed code output, say MyCustomActions.dll. Windows Installer doesn't support managed code in custom actions, so the managed code has to be wrapped in an unmanaged native code
wrapper, so in a post-build step, it injects the managed output into the unmanaged wrapper and _that_ then becomes the project's build output and will be named MyCustomActions.CA.dll. I believe that Code Contracts may be trying to open the unmanaged wrapper
file and discovering that it is not managed code ("invalid format").
In order for CCRewrite to work here, it would need to run on the managed code _before_ it gets wrapped in the unmanaged wrapper. I am not sure how we can hook into the build process to get that to happen.
It might be possible to somehow make a WiX Custom Action project by creating a standard C# class library, which would work correctly with CCRewrite, then somehow performing the WiX packaging as a post-build step. I'm not sure what is required though, exactly.
Any ideas?
--Tim Long
Tim Long -
Can't load dates in any format
Hello everybody I have the following problem:
After i have upgrade from Standard Edition1 to Enterprise Edition for trying to solve the localization problem in the Presentation (i needed Greek) all the mappings that inserts dates to my cubes from external tables (CSV) or the flows that i put a date as an input don't work as the system complains for incorrect format error: "CursorFetchMapTerminationRTV20007 ORA-01843: not a valid month". I have tried all the possible combinations of a date format but still nothing. The Server lam running the OWB has nls_language= Greek at session parameters while at database parameters is nls_language = American. I have tried also to alter the session during the transformation (Alter Session set nls_language = Greek, set Nls_teritiory= Greece) and it diddn't work either.
Thnx in advance
LexDear Detlef,
This was very helpfull! The process flows and the mapping seems to run ok again! Only one thing left now. I use sql script to run the mappings which looks like that:
DECLARE
temp_ok INTEGER;
begin
temp_ok := owb_owner.WB_RT_API_EXEC.RUN_TASK('REP_USER_LOCATION', 'PLSQLMAP', 'DIAXEIRISTIKH_ARXH_MAP_K1', *'PAY_DAY=01/01/2008,'*, ',', 0, 1);
IF temp_ok = 2 THEN
RAISE_APPLICATION_ERROR(-20001, 'WARNING DURING EXECUTION OF THE MAPPING');
ELSIF temp_ok = 3 THEN
RAISE_APPLICATION_ERROR(-20002, 'ERROR DURING EXECUTION OF THE MAPPING');
END IF;
end;
The bold parameter is the input parameter of the mapping. I use PAY_DAY as varchar2 and then I use to_date() again.
It seems that this isn't the proper way to input a string cause it returns error. I used PAY_DAY='01/01/2008' or PAY_DAY="01/01/2008" or PAY_DAY=/'01/01/2008/' with no results.
Do you know something about that, or just a way to import a string?
thnx in advance,
Lex. -
How to know whether entered date is SAPdate format or User dateformat.
Hi all,
I am uploading data from SAP to internal table ,
here I need to do below logic ,
If user entered SAP dateformat in excel , no need to convert after uploading.
elseIf user entered user default need to convert to SAP date format.
If user entered in other foramt.
need to give error.
so , how to know whether entered data is in SAP format or not.
Regards,
vineshTry this logic
IF call fm DATE_CHECK_PLAUSIBILITY = true
"date etered in SAP internal format
ELSE if call fm CONVERT_DATE_TO_INTERNAL = true
"date entered in user format
else.
"incorrect format
endif.
Regards
Marcin -
DateValidator, Configuration error: Incorrect formatting string
Hi guys,
I am struggling with a DateValidator issue, I hope someone can help me
Here is the parts of code needed to check what's wrong:
public const DATE_FORMAT:String = "DD/MMMM/YYYY";
<mx:DateFormatter id="dateFormatter" formatString="{DATE_FORMAT}" />
<mx:DateValidator
id="firstDateValidator" inputFormat="{DATE_FORMAT}" required="true"
source="{firstDate}" property="text" />
<mx:DateFiel id="firstDate" labelFunction="doLabel" />
private function doLabel(item:Date):String
return dateFormatter.format(item);
I need to format and validate the following example: 13/January/2011
When I use DATE_FORMAT = "DD/MM/YYYY", I have no problem to format and validate the Datefield, I have 13/01/2011.
But when I use DATE_FORMAT = "DD/MMMM/YYYY", I have the following error message with the validator (the formatter is working well):
Configuration error: Incorrect formatting string.
Thank you very much for your help.Standard Flex validator out of the box is very fragile when it comes to validate "non-standard" date formats. You should extend this DateValidator with your own version like I do, that re-implements "format" function call and rewrites private function "validateFormatString" from the the scratch.
Here is the my implementation of this function:
private static function validateFormatString(validator : DateRangeValidator,
separatorSign : String,
formatPartsArray : Array,
baseField : String) : ValidationResult {
var formatPartsValidationObject : Object = {dayValid : false,
monthValid : false,
yearValid : false};
var formatsLength : int = formatPartsArray.length;
var mask:String;
for (var i : int = 0; i < formatsLength; i++) {
mask = formatPartsArray[i];
switch (mask) {
case "M" :
case "MM" :
case "MMM" :
case "MMMM" :
formatPartsValidationObject.monthValid = true;
break;
case "YY" :
case "YYYY" :
formatPartsValidationObject.yearValid = true;
break;
case "D" :
case "DD" :
formatPartsValidationObject.dayValid = true;
break;
if (formatPartsValidationObject.monthValid &&
formatPartsValidationObject.dayValid &&
formatPartsValidationObject.yearValid) {
return null; // Passes format validation
} else {
return new ValidationResult(
true, baseField, "format",
validator.formatError);
formatPartsArray is calculated as follows:
var formatPartsArray : Array = inputFormat.split("/"); -
Scheduling Agreement –delivery date in month format - MD04
Dear experts,
Scheduling Agreement, forecast delivery schedule.
When I enter a delivery date in month format, the system, during processing, automatically checks the factory calendar and proposes the first valid working day as the delivery date. ( Yes. I know it is a SAP standard )
My requirement is automatically checks by the system the last working day as the delivery date.
Could you tell me what are the settings i need to check to resolve this issue?
Thanks in advance
arturAs pointed out already above you need to use a periodic lot sizing procedure.
Use Lot sizing procedure P, Lot size indicator K and Scheduling =2
As per your requirement, you need to create a calendar using MD25 with Months (Workdays) as a calculation rule with 1 as the period in the box provided.
After a MRP run the delivery date would point to the last day of the month.
But the requirement is a bit surprising as say for a requirement on the 1st of the month you will have the delivery showing up on the last day of the same month. Under what circumstances do you have this requirement as a valid one in your business case? -
How to display the data in PDF format : problem is splitting into 2 lines
Hi ,
I developed one report which downloads the data into PDF format and saved in C drive but my problem is
in my program : Line size of the report is 255 in PDF it is splitting into 2 lines. it has to show in a single line. how to do it. how to reduce the width of the output? i am sending my code below. anybody can suggest me how to do it. if possible please send me the code.
my code:
report zmaheedhar.
maheedhar-start
TABLES : vbak.
parameters : p_vbeln type vbak-vbeln.
data : begin of itab occurs 0,
vbeln type vbak-vbeln,
ERDAT type vbak-erdat,
ERZET type vbak-erzet,
ERNAM type vbak-ernam,
ANGDT type vbak-angdt,
BNDDT type vbak-bnddt,
AUDAT type vbak-audat,
VBTYP type vbak-vbtyp,
TRVOG type vbak-trvog,
AUART type vbak-auart,
AUGRU type vbak-augru,
GWLDT type vbak-gwldt,
SUBMI type vbak-submi,
LIFSK type vbak-lifsk,
FAKSK type vbak-faksk,
NETWR type vbak-netwr,
WAERK type vbak-waerk,
VKORG type vbak-vkorg,
end of itab.
maheedhar-end
DATA: pripar TYPE pri_params,
arcpar TYPE arc_params,
lay TYPE pri_params-paart,
lines TYPE pri_params-linct,
rows TYPE pri_params-linsz.
DATA: val(1), val1(1).
*---> Local Printer Name defined in SAP, Change NHREMOTE to your local printer
DATA: dest TYPE pri_params-pdest VALUE 'ZNUL'.
DATA: name TYPE pri_params-plist VALUE 'Testing'.
DATA: i_pdf TYPE STANDARD TABLE OF tline.
DATA: spono TYPE tsp01-rqident.
maheedhar-start
top-of-page.
write: 'Sales Document' , 'C Date', 'Entry time', 'Created By','Quotation date',
'Date','Document Date','SD document category','Transaction group','Sales Document Type',
'Order reason'.
start-OF-SELECTION.
select vbeln ERDAT ERZET ERNAM ANGDT BNDDT AUDAT
VBTYP TRVOG AUART AUGRU GWLDT SUBMI LIFSK
FAKSK NETWR WAERK VKORG from vbak
into table itab
where vbeln = p_vbeln.
maheedhar-end
--- Retreive local printer details
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
destination = dest
no_dialog = 'X'
immediately = ' '
IMPORTING
out_archive_parameters = arcpar
out_parameters = pripar
valid = val
valid_for_spool_creation = val1
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
*-- Set Spool printer details w.r.t local printer
pripar-prdsn = 'DSN'.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
in_archive_parameters = arcpar
in_parameters = pripar
no_dialog = 'X'
list_name = name
IMPORTING
out_archive_parameters = arcpar
out_parameters = pripar
valid = val
valid_for_spool_creation = val1
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
IF sy-subrc EQ 0.
---> Triggers the spool creation in the sense all the write statements from hereon will be written to spool instead of screen
NEW-PAGE PRINT ON
NEW-SECTION
PARAMETERS pripar
ARCHIVE PARAMETERS arcpar
NO DIALOG.
ELSE.
WRITE:/ 'Unable to create spool'.
ENDIF.
*--- Output statements
*WRITE:/ 'First Line', 'mahee','lklk','kikik','lokiuj','fffff','kijuyh','fgfgfgfg','gtgtgtgtgtgtgtgtggggggggggggggggggggggggggggggg'.
*WRITE:/ 'Second Line'.
LOOP at itab.
write: itab-vbeln,
itab-ERDAT,
itab-ERZET,
itab-ERNAM,
itab-ANGDT,
itab-BNDDT,
itab-AUDAT,
itab-VBTYP.
ENDLOOP.
"---> Close spool
NEW-PAGE PRINT OFF.
spono = sy-spono.
Convert ABAP Spool to PDF
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = spono
no_dialog = 'X'
TABLES
pdf = i_pdf
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12.
Download PDF contents to presentation server
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'c:\test.pdf'
filetype = 'BIN'
TABLES
data_tab = i_pdf
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22.
thanks,
maheedharhi tripat,
actual problem is what u said it is decreased the wiidht of the output.
now the output is:
Sales Document C Date Entry time Created By Quotation date Date Document Date
SD document category Transaction group Sales Document Type Order reason
62741 07/29/1996 11:54:38 DARLENE 00/00/0000 00/00/0000 07/29/1996 C
actual output is:
output should come in a single line. it is splitting into 2 lines.
thanks,
maheedhar -
I recently downloaded a book "In a Pit with a Lion on a Snowy Day" and iBooks tells me its incorrectly formatted even though I downloaded this from iTunes and have the latest version of the iBooks app. What is going on? I want a refund if this doesn't work. My other books open fine.
The Report a Problem link can also be found in iTunes/Store/View Account/Purchase History.
Before asking for a refund, also try deleting the book and redownloading it.
If you find that the iBookstore is does not meet your needs, you can try one of the others like Kindle, Nook, Kobo, Googlebooks, or Sony.
To let Apple know your views on their apps or services, use
http://www.apple.com/feedback -
This was all working yesterday, but this morning, I cannot run in the dev fabric, or even setting the website project as a startup project directly, I get the following error:
Could not load file or assembly 'msshrtmi' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.BadImageFormatException: Could not load file or assembly 'msshrtmi' or one of its dependencies. An attempt was made to load a program with an incorrect format.
Source Error:
An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Assembly Load Trace: The following information can be helpful to determine why the assembly 'msshrtmi' could not be loaded.
=== Pre-bind state information ===
LOG: User = Andrew-VAIO\Andrew
LOG: DisplayName = msshrtmi
(Partial)
WRN: Partial binding information was supplied for an assembly:
WRN: Assembly Name: msshrtmi | Domain ID: 3
WRN: A partial bind occurs when only part of the assembly display name is provided.
WRN: This might result in the binder loading an incorrect assembly.
WRN: It is recommended to provide a fully specified textual identity for the assembly,
WRN: that consists of the simple name, version, culture, and public key token.
WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
LOG: Appbase = file:///C:/Users/Andrew/Desktop/Beko2011Azure/Website/
LOG: Initial PrivatePath = C:\Users\Andrew\Desktop\Beko2011Azure\Website\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\Andrew\Desktop\Beko2011Azure\Website\web.config
LOG: Using host configuration file:
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/cb955b02/eef106e2/msshrtmi.DLL.
LOG: Attempting download of new URL file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/Temporary ASP.NET Files/root/cb955b02/eef106e2/msshrtmi/msshrtmi.DLL.
LOG: Attempting download of new URL file:///C:/Users/Andrew/Desktop/Beko2011Azure/Website/bin/msshrtmi.DLL.
ERR: Failed to complete setup of assembly (hr = 0x8007000b). Probing terminated.
Stack Trace:
[BadImageFormatException: Could not load file or assembly 'msshrtmi' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +0
System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks) +39
System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection, Boolean suppressSecurityChecks) +132
System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection) +144
System.Reflection.Assembly.Load(String assemblyString) +28
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +46
[ConfigurationErrorsException: Could not load file or assembly 'msshrtmi' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Web.Configuration.CompilationSection.LoadAssemblyHelper(String assemblyName, Boolean starDirective) +618
System.Web.Configuration.CompilationSection.LoadAllAssembliesFromAppDomainBinDirectory() +209
System.Web.Configuration.CompilationSection.LoadAssembly(AssemblyInfo ai) +130
System.Web.Compilation.BuildManager.GetReferencedAssemblies(CompilationSection compConfig) +178
System.Web.Compilation.BuildManager.GetPreStartInitMethodsFromReferencedAssemblies() +94
System.Web.Compilation.BuildManager.CallPreStartInitMethods() +332
System.Web.Hosting.HostingEnvironment.Initialize(ApplicationManager appManager, IApplicationHost appHost, IConfigMapPathFactory configMapPathFactory, HostingEnvironmentParameters hostingParameters, PolicyLevel policyLevel, Exception appDomainCreationException) +677
[HttpException (0x80004005): Could not load file or assembly 'msshrtmi' or one of its dependencies. An attempt was made to load a program with an incorrect format.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +9079228
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +97
System.Web.HttpRuntime.ProcessRequestInternal(HttpWorkerRequest wr) +258
Note that the dev machine is x64 Win7.
I have not tried deploying this to staging since the issue started as I'm a bit nervous of touching the staging/live environment until this is solved.
Removing the PlatformTarget element from the project file has no effect
Removing the msshrtmi.dll file from the bin directory of the website project ends up with
'Could not load file or assembly 'Microsoft.WindowsFabric.Common, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified'
I have used Git to revert to the last working build to no effect (But I don't have the obj/bin folders in GIT), but it has atleast reset the project files etc.
If I return msshrtmi.dll to the bin folder and switch the model and website projects to x64 there is no change
If I switch both to x86 then I get an error Could not load file or assembly 'BekoModel2011' or one of its dependencies. An attempt was made to load a program with an incorrect format.
which is the model project - presumably because to run on my x64 machine I need the 64bit version?
I really need to be able to debug and then publish some changes ASAP.
AndrewHi,
Is it true that you're using IIS to host the application? Could you check whether the process is x64 or x86 one via task manager or config in IIS manager?
http://blogs.msdn.com/b/rakkimk/archive/2007/11/03/iis7-running-32-bit-and-64-bit-asp-net-versions-at-the-same-time-on-different-worker-processes.aspx
Allen Chen [MSFT]
MSDN Community Support | Feedback to us
Get or Request Code Sample from Microsoft
Please remember to mark the replies as answers if they help and unmark them if they provide no help. -
Convert a date in String format to a Date
Hi,
How can I convert a date in String format to a Date object?
I have tried:
import java.text.*;
import java.io.*;
import java.util.Date;
import java.util.Locale;
import java.sql.*;
public class casa {
public static Connection con = null;
public static Statement s = null;
public static String sql = null;
public static String mydate = "01.01.2001";
/** Creates a new instance of casa */
public casa() {
public static void main(String[] args) throws SQLException{
try {
DateFormat shortFormat = DateFormat.getDateInstance(DateFormat.SHORT);
Date date = shortFormat.parse(mydate);
//Open Database
con = getConnection();
s = con.createStatement();
sql = "select date1 from table1 where date1 <= '"+date+"'";
ResultSet rs = s.executeQuery(sql);
while(rs.next()){
String aba = rs.getString("datum");
System.out.println("New Datum = "+aba);
} catch (Exception ex ) {
ex.printStackTrace();
closeConnection(s, con);
//Connection
private static Connection getConnection() {
Connection con = null;
String user ="aouzi";
String passe ="aouzi";
String url = "jdbc:db2:EjbTest";
try {
//Datenbanktreiber laden
Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
//Verbindung herstellen
con = DriverManager.getConnection(url,user,passe);
}catch(ClassNotFoundException e){
} catch(SQLException e){}
return con;
//close Connection
private static void closeConnection(Statement s, Connection con) {
try {
s.close();
} catch (SQLException e) {}
try {
con.close();
} catch (SQLException e) {}
I'm getting the following errors:
COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0180N
The syntax of the representation of a date/time of day value as character sequence is false. .SQLSTATE=22007I'm pretty sure it won't understand what date.toString() returns. If you know what format the database understands, you do it like this:
SimpleDateFormat sdf = new SimpleDateFormat("dd-MMM-yy"); // e.g. 18-Apr-02
String datestring = sdf.parse(date);
and use that instead of date in your sql string. Some databases understands it if you do
"to_date('18-Apr-02')"
so you could include that in your sql string as well..
You could also try to make it a java.sql.Date and hope your jdbc driver knows how to convert it to a string that the database understands if you don't know the format:
con = getConnection();
PreparedStatement ps = con.prepareStatement("select date1 from table1 where date1 <= ?");
ps.setDate(new java.sql.Date(date.getTime()));
ResultSet rs = s.executeQuery(sql); -
How to change a date in one format to the other?
Hi,
Say I have a String representing a date in the following format:
dd/MM/yyyy e.g. 12/03/2002
How can I convert this String to a String representing a date the following format:
ddMMyyyy e.g. 12032002
Without using the String class.
ThanksLet's write some code here:
String f1="dd/MM/yyyy";
String f2="ddMMyyyy";
String d1="12/03/2002";
String d2=null;
You want d2 of format f2, given d1 with format f1 =>
SimpleDateFormat formatter1 = new SimpleDateFormat (f1);
SimpleDateFormat formatter2 = new SimpleDateFormat (f2);
ParsePosition pos = new ParsePosition(0);
java.util.Date dateTemp = formatter1.parse(d1, pos);
d2 = formatter2.format(dateTemp);
That should work.
Diego -
How do you vary the Date/Time stamp format in File Adapters
In the receiver channel of the File Adapter where you specify the 'File Name Scheme', you do have the option of specifying a 'File Construction Mode' of 'Add Time Stamp'. How can you specify a different Date/Time stamp format ( eg MM/DD/YY vs YYYYMMDD vs MMDDYY, etc. ) without changing the Date/Time stamp for the entire SAP system? Also, can you control where the Date/Time stamp appears in the filename?
Hi,
There are many threads discussing the same issue. Go thro the following:
Dynamic file name (Date) in Receiver File Adapter
Receiver File Adapter - TimeStamp
Bhavesh's reply in above thread:
You can use Adapter Specific Identifiers and then change the file name in the mapping. Append the tiem stamp in the format that you want and so on.
Just use this code in an UDF,
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String SourceFileName = conf.get(key);
java.text.SimpleDateFormat dateformat = new java.text.SimpleDateFormat( "yyyyMMdd" );
dateformat.format( new java.util.Date() );
String newfilename=SourceFileName+dateformat;
// change to new file name
conf.put(key, newfilename);
return "";
Regards,
P.Venkat -
Converting Date Column to format MM/DD/YYYY in RPD
Hi all,
I have a requirement like converting a Date column to format MM/DD/YYYY in RPD. Any help as we are not supposed to use the BI Answers Data Fomat for showing this format.
Thankyou,
Edited by: [email protected] on May 10, 2010 11:49 PMHi Saichand,
I need the resulting column in DATE format only. The solution which you specified converts the datatype to character. Is there anyway to convert the format but not the datatype. -
I am currently deployed over seas.. I recently purchased a book that im pretty stoked about. but when i open it in ibooks i get ( incorrectly formatted or not formatted for ibooks to recognize) the file is an .epub so i dont see how it could be a format issue.. I tried emailing apple but because of the situation they want me to call. I have very limited telecomminications at my location .. somebody please help
The Report a Problem link can also be found in iTunes/Store/View Account/Purchase History.
Before asking for a refund, also try deleting the book and redownloading it.
If you find that the iBookstore is does not meet your needs, you can try one of the others like Kindle, Nook, Kobo, Googlebooks, or Sony.
To let Apple know your views on their apps or services, use
http://www.apple.com/feedback -
How to convert the alv list data into pdf format
Hi Expersts,
Is it possible to convert the alv list output data into PDF format? if yes, then please help me with this issue.
thanks in advance,
Regards,
Samadhii samad,
you can go through these link.i hope it ll solve your purpose
How to convert list output to PDF
Display ALV list output in PDF format
regards,
Shweta
Maybe you are looking for
-
Is there a way to create a field with total pages viewed?
Is there a way to create a field for a contact that stores the total # of pages he has ever viewed? We'd like to use this as a bases for lead scoring.
-
PAGES application no longer works - I have reinstalled software
For some unknown reason the Pages application in my IWORKS bundle has stopped working and this is the main reason I purchased IWORKS was to use the Pages. I followed the suggestions...check for updates - there were none and I have installed the softw
-
My intel imac is running very slow
I have a 20" intel imac and recently it has started to run very slow. It takes ages to start up and once started it takes forever to start any application. i have tried various software to clean it up but still no better. When starting it in safe mod
-
Running a batch file on a web server
hi, i am facing a problem regarding running a batch file(with a java command in that file) on a web server. i am having a batch file which is running a chatapplication (this file is having a single line -- "java ChatServer 8080") i want to execute th
-
I am getting entity ref not referenced..end with ';' delimeter for the below code
<mx:Image click="{navigateToURL(new URLRequest(' http://www.facebook.com/group.php?gid=149134532537&ref=ts'))}">