![]() ![]() The local time offset is shown at the start of each local region list item. If your local time zone is not selected, click it in the list of available time zones. To do this, follow these steps on a Microsoft Windows-based computer:Ĭlick Start, click Run, type timedate.cpl, and then click OK.Ĭlick the Time Zone tab, and then verify that your local time zone is selected. To convert UTC to local time, follow these steps:ĭetermine your local time offset from UTC time. This article describes how to convert UTC to local time to verify that the file that is on your computer is the one that is discussed in the documentation. I suppose I could just brute force a hard-coded offset by adding four hours, but I think the above is the "correct" way.Microsoft uses Coordinated Universal Time (UTC) format, an international standard 24-hour timekeeping system, to document the created dates and times of files that are included in a software update. exec_sql to update r_modify_date: execute exec_sql with query = 'update dm_sysobject_s set r_modify_date = TO_DATE('' 15:44:30'',''MM/DD/YYYY HH24:MI:SS'') where r_object_id = ''09ae12f980002934'' ' Modify Date in Local Time Zone: 11:44:30 Output: DFC Modify Date String: 11:44:30 UpdateQueryString = "execute exec_sql with query = 'update dm_sysobject_s set r_modify_date = TO_DATE(''" + sdf.format(cal.getTime()) + "'',''" + oracleDatePattern + "'') where r_object_id = ''" + objectIdString + "'' '" If (m_debugMode) m_File.writeBytes("Modify Date in UTC Time Zone: " + sdf.format(cal.getTime()) + NEWLINE) If (m_debugMode) m_File.writeBytes("Modify Date in Local Time Zone: " + sdf.format(cal.getTime()) + NEWLINE) SimpleDateFormat sdf = new SimpleDateFormat(javaDatePattern) ![]() If (m_debugMode) m_File.writeBytes("Converted Modify Date: " + cal.toString() + NEWLINE) If (m_debugMode) m_File.writeBytes("DFC Seconds: " + modifyDate.getSeconds() + NEWLINE) Ĭal.set(modifyDate.getYear(), modifyDate.getMonth(), modifyDate.getDay(), modifyDate.getHour(), modifyDate.getMinutes(), modifyDate.getSeconds()) If (m_debugMode) m_File.writeBytes("DFC Minutes: " + modifyDate.getMinutes() + NEWLINE) If (m_debugMode) m_File.writeBytes("DFC Hour: " + modifyDate.getHour() + NEWLINE) If (m_debugMode) m_File.writeBytes("DFC Day: " + modifyDate.getDay() + NEWLINE) If (m_debugMode) m_File.writeBytes("DFC Month: " + modifyDate.getMonth() + NEWLINE) If (m_debugMode) m_File.writeBytes("DFC Year: " + modifyDate.getYear() + NEWLINE) GregorianCalendar cal = new GregorianCalendar() TimeZone utcTimeZone = TimeZone.getTimeZone("UTC") TimeZone localTimeZone = TimeZone.getDefault() If (m_debugMode) m_File.writeBytes("DFC Modify Date String: " + strModifyDate + NEWLINE) String strModifyDate = modifyDate.asString(dfcDatePattern) String oracleDatePattern = "MM/DD/YYYY HH24:MI:SS" String javaDatePattern = "MM/dd/yyyy HH:mm:ss" String dfcDatePattern = "mm/dd/yyyy hh:mi:ss" adjust modify date for UTC to send to database Yes, there are better ways but this was supposed to be a quick widget. ![]() Note: I am writing debug statements to a batch job log file that gets generated by the app instead of stdout. So, using Calendar and SimpleDateFormat to convert it to specific-formatted string that I can send to database with UTC string in SQL update statement. I have converted it to string and it looks like expected (EST for me). ModifyDate is the Date-like object that is returned by app API. For some reason, my code is adding a month. I need to convert to UTC to send to oracle database. ![]() The API automatically converts date to local time zone (EST). I am working under an application API (DFC) that is giving me a Date-like object (IDfTime). ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |