Re: Reconvertir tiempo unix epoch a fecha copmun en asp Resultados 1 - 10 de aproximadamente 421,000 de timestamp +asp -.net -php. (0.14 segundos)
Código:
<%
Function ConvertSQLTimeStamp(strDateTime)
'Depending on regional settings, VBS may display time with AM/PM, and date as MM-DD-YYYY
'MySQL accepts timestamps in the following format: 'YYYY-MM-DD HH:MM:SS' (military time)
'In reality MySQL will accept timestamps like the following: '1999-1-6 5:4:3' and store
'them as '1999-01-06 05:04:03' appropriately.
'Get the year
ConvertSQLTimeStamp = Year(strDateTime) & "-"
'Get the month
ConvertSQLTimeStamp = ConvertSQLTimeStamp & Month(strDateTime) & "-"
'Get the day
ConvertSQLTimeStamp = ConvertSQLTimeStamp & Day(strDateTime) & " "
'Get the time (HH:MM - military format)
ConvertSQLTimeStamp = ConvertSQLTimeStamp & FormatDateTime(strDateTime, vbShortTime)
'Get and add the second
ConvertSQLTimeStamp = ConvertSQLTimeStamp & ":" & DatePart("s", strDateTime)
End Function
Function ConvertVBSTimeStamp(strDateTime)
'This function is completely unnecessary, however it is here to show how to convert
'MySQL timestamps to a different format. VBS can convert SQL timestamp directly without
'any modifications necessary.
'Format strDateTime using the systems regional settings
ConvertVBSTimeStamp = FormatDateTime(strDateTime)
End Function
%>
|