I'm having some issues with a pre-made Java master table.
The problem is that it requires to show an inserted date from my PHPMyAdmin in the form off dd-mm-yyyy-hh-mm-ss, but instead it only shows dd-mm-yyyy. Only if I edit it in the application itself it shows me the correct form.
I know some methods to format it but I could not figure out how to use these in a premade master table.
Use DateAndTime in Java and in your PhpMyAdmin have you declare a Date and Time or just Date?
Related
I am working with an OAF extension in Oracle EBS. We have attribute columns (varchar datatype) provided by Oracle where we can store additional data. We need to store two date fields which are entered by the user.
In the OAF Java page, when user selects the date from the calendar pick and hit save it stores in the format - YYYY-MM-DD in the DB table. eg 2022-05-22
But while being retrieved I need to show that as MM/DD/YYYY to show the dates in alignment in OAF page. The problem here is that next time (2nd time onwards) when we try to save (not by selecting the calendar again as dates are already populated in the view) it's saved in the format MM/DD/YYYY. And there onwards the below view query fails.
select TO_CHAR(TO_DATE(2022-05-22, 'YYYY/MM/DD'),'MM/DD/YYYY') from dual;
Is there a way I can always enforce to store the value as MM/DD/YYYY either in the JAVA code or the PL/SQL Package that's being called. I am basically retrieving the field value in JAVA and invoking the PL/SQL procedure to update it in the table.
DBUtil.setString((OraclePreparedStatement)oracleCallableStatement, b1++, busClassVORowImpl.getAttribute1())
DBUtil.setString((OraclePreparedStatement)oracleCallableStatement, b1++, busClassVORowImpl.getAttribute2())
I'm trying to get the user to pick a date and then on click of a button will display all the content from Firestore related to that data.
Here mDisplayDate is a DatePicker Dialog and I want to display the data. I've done the display part but whereEqualTo() takes two hard coded strings as field and value.
noteBookref.whereEqualTo("Date" , mDisplayDate.toString()).orderBy("Date", Query.Direction.DESCENDING).get();
The Database looks like this
I'm trying to filter firestore content on basis on of a date picked by user. Say Display all data for 14th Feb
You are storing the Date property as a String you are doing it wrong.
To be able to query your database according to a specific date, your Date property should be o type Date and not String. To see how you can achieve this, please take a look at my answer from this post.
Once you have the property set correctly, a query like this should do the trick:
noteBookref.whereEqualTo("Date" , date).orderBy("Date", Query.Direction.DESCENDING).get();
In which date is a Date object representing the date you are looking for. Remember to delete the existing data and add fresh one.
I am using bootstrap datetimepicker and using format as YYYY-MM-DDTHH:mm:ssZ the text input I am storing as it is in database column.
I have to store it as string only. While fetching records I am passing fromdate and toDate which are for applications timezone (other than client machine). We set timezone through application as well.
For MySQL query I am doing date comparison using:
str_to_date(column_name,'%Y-%m-%dT%T')
This gives an issue in fetching records. Any suggestions?
My problem is when I am not sure whether I am right about datetimepicker format.
I have to store it as string only.
Stop. Right there. There are very few reasons why you would really want to store your dates and timestamps in a MySQL database as pure text. Instead, you should be using a date column, which would alleviate your need to call STR_TO_DATE in the first place.
With regard to your call to STR_TO_DATE, I think your format mask should be this:
STR_TO_DATE(column_name, '%Y-%m-%dT%H:%i:%sZ')
This appears to be working in the demo below.
Demo
User inputs date from JSP page, and it converts to Joda DateTime, the string output is
2014-03-26T00:00:00.000+09:00
However when I persist this entity containing date filed in database, and retrieve and print out again, it becomes
2014-03-25T09:00:00.000+09:00.
I don't know why database make this change to minus one day.
I use postgres, hibernate JPA for application development.
Thanks in advance.
What is the value in the database? Use pgAdmin app, the psql command line tool, or some other database admin tool to query Postgres directly.
What data type are you using in Postgres? You probably should be using TIMESTAMP WITH TIME ZONE. Avoid using the WITHOUT time zone type as it ignores any time zone offset info you may provide.
Despite the name, neither type stores any time zone info. The difference is whether you want Postgres to pay any attention to time zone info on incoming data. Be sure to read the doc thoroughly and play with it to experiment until understand how date-time works.
Read Always Use TIMESTAMP WITH TIME ZONE by David E. Wheeler, a Postgres expert.
I made a report as of the date of purchase transactions.
I want to display the format as below:
In pictue above the date is only displayed once at the top.
Now, the date shown in each record that appears.
I already have the solution using subreport. In my report i select distinct for the date. And subreport using parameter from primary report.
But the problem now is, the data in each date is duplicate in every row.
How to handle that?
You can use Subreport to do this. Example i will have two sql, the first sql i will call DISTINCT all date and then the second sql (use for subreport) i will get all data have date like date in the first sql (using parameter). (Sorry my English is not good, i can'tardescrip all for you :).)