05-06-2019, 06:11 PM
Hello Gintaras,
Hope all is well!
I have to convert from Unix Epoch Time to regular humna readable Date Time format.
eg. 1556915575 --> '5/3/2019 4:32 PM'
I am not sure if this is already enabled by the DateTime functions in QM.
I looked through and wasn't able to figure out myself.
A colleague gave me the code below for conversion. But before I went to figure out how to implement in QM, I thought I would check if this conversion not already supported by existing functions.
Thanks so much,
S
Hope all is well!
I have to convert from Unix Epoch Time to regular humna readable Date Time format.
eg. 1556915575 --> '5/3/2019 4:32 PM'
I am not sure if this is already enabled by the DateTime functions in QM.
I looked through and wasn't able to figure out myself.
A colleague gave me the code below for conversion. But before I went to figure out how to implement in QM, I thought I would check if this conversion not already supported by existing functions.
Thanks so much,
S
private string sUTCOffset = string.Empty;
private string sUNIXEpoch = "1-Jan-1970 00:00:00";
// Determine the daylightTime saving so the offset can be applied correctly.
TimeZoneInfo tzi = TimeZoneInfo.FindSystemTimeZoneById("Eastern Standard Time");
bool isDayLightSavingTime = tzi.IsDaylightSavingTime(DateTime.Now);
if (isDayLightSavingTime)
sUTCOffset = " - 4/24";
else
sUTCOffset = " - 5/24";
// convert oracle unix date_time_created to datetime characters in c# codes
"TO_CHAR((TO_DATE('" + sUNIXEpoch + "','dd-mon-yyyy hh24:mi:ss') + (DOSR_STUDY.DATE_TIME_CREATED/60/60/24 ) " + sUTCOffset + " ), 'MM/DD/YYYY HH24:MI:SS') AS DATE_TIME_CREATED
// convert oracle unix date_time_created to datetime in c# codes
to_date('" + sUNIXEpoch + "','dd-mon-yyyy hh24:mi:ss') + (dosr_study.DATE_TIME_CREATED/60/60/24) " + sUTCOffset + " ) AS Date_Time_Created,sysdate - " + Minutes + "/(24*60), "