#import "se/datetime/DateTime.e"int Epoch=1340360050; // Just an example time_str Year="0", Month="0", Day="0";_str Hour="0", Minute="0", Second="0";se.datetime.DateTime myTime;myTime = se.datetime.DateTime.fromTimeB((Epoch+10302239676800)*1000);parse myTime.toStringLocal() with Year '-' Month '-' Day 'T' Hour ':' Minute ':' Second '.';insert_line(Hour ':' Minute ':' Second ' of ' Year '-' Month '-' Day);
_command MAS_EPOCH_To_Date() name_info(','VSARG2_MACRO|VSARG2_MARK|VSARG2_REQUIRES_MDI_EDITORCTL){ int eSecond=0; int Kolonne=p_col; MAS_Copy_Word(); // Just select the word under the cursor if (isnumber(MST_Get_Selected_Text())) { eSecond=MST_Get_Selected_Text(); eSecond+=3600; // Plus one hour for CET int eYear=1970; while (eSecond >= MST_Seconds_In_Year(eYear)) { eSecond-=MST_Seconds_In_Year(eYear); eYear+=1; } int eMonth=1; while (eSecond >= MST_Seconds_In_Month(eMonth,eYear)) { eSecond-=MST_Seconds_In_Month(eMonth,eYear); eMonth+=1; } int eDay=eSecond/86400; eSecond-=eDay*86400; eDay++; // There is no day 0. int eHour=eSecond/3600; eSecond-=eHour*3600; int eMinute=eSecond/60; eSecond-=eMinute*60; _str Result=''_pad(eYear,2,'0','L')'-'_pad(eMonth,2,'0','L')'-'_pad(eDay,2,'0','L')' '_pad(eHour,2,'0','L')':'_pad(eMinute,2,'0','L')':'_pad(eSecond,2,'0','L'); _insert_text('='Result); } deselect(); p_col=Kolonne; down(1);}int MST_Seconds_In_Year(int lYear){ int i=31536000; if ((lYear % 4) == 0) { i+= 86400 } return i;}int MST_Seconds_In_Month(int lMonth,int lYear){ int i=0; switch (lMonth) { case 1: // Jan case 3: // Mar case 5: // Mai case 7: // Jul case 8: // Aug case 10: // Okt case 12: // Dec i=86400*31; break; case 2: // Feb i=86400*28; if ((lYear % 4) == 0) { i+= 86400 } break; case 4: // Apr case 6: // Jun case 9: // Sep case 11: // Nov i=86400*30; break; } return i;}