User1208776063 posted
1. how to save text fields data to
yyyy/mm/dd hh:mm format in table.
You haven't specified the database that you are using to store the data. I would recommed using a DateTime column to store this type of string. MySQL database provides a way to specify the format that you can save(I read this somewhere, I'm not an expert
in MySql Database). If you are using just a varchar field to store a date string in specific format, you would have to parse column value to date value for comparison(I've noticed date comparisons are marginally faster than just comparing 'date
string' to 'date string'). It also depends on the purpose of this column. But, I would recommend saving data in a dateTime column and handling the formatting in front end/queries(TO_CHAR in Oracle or CONVERT(VARCHAR) in SQL server)
2. how to calculate how many hours difference in that format yyyy/mm/dd hh:mm when compare 2 fields?
If you are comparing two datetime values, you can use DateDiff in SQL Server, different ways in Oracle. It depends on the database that you are using.