?????????????????(java .net ?????)
?????С?? ???????[ 2017/7/5 10:16:38 ] ??????????????????? Java ?????
?? Java???????
/*
???? * ????????????? */
???? public static String dateToStamp(String s) throws ParseException{
???? String res;
???? SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
???? Date date = simpleDateFormat.parse(s); long ts = date.getTime();
???? res = String.valueOf(ts); return res;
???? }
???? /*
???? * ????????????? */
???? public static String stampToDate(String s){
???? String res;
???? SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); long lt = new Long(s);
???? Date date = new Date(lt);
???? res = simpleDateFormat.format(date); return res;
???? }
??
??.Net ???????
????????????????UNIX????
DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970??1??1));
DateTime dtNow = DateTime.Parse(DateTime.Now.ToString());
TimeSpan toNow = dtNow.Subtract(dtStart);string timeStamp = toNow.Ticks.ToString();
timeStamp = timeStamp.Substring(0??timeStamp.Length - 7);
??????UNIX??????????????
string timeStamp = "1144821796";
DateTime dtStart = TimeZone.CurrentTimeZone.ToLocalTime(new DateTime(1970??1??1));long lTime = long.Parse(timeStamp + "0000000");
TimeSpan toNow = new TimeSpan(lTime);
DateTime dtResult = dtStart.Add(toNow);
????Oracle????timestamp???
????//???????
????INSERT INTO tablename(
????CUSTID??
????UPDATETIMESTAMP
????)VALUES(
????#{custid?? jdbctype=VARCHAR}??
????TO_TIMESTAMP(#{updatetimestamp}??'syyyy-mm-dd hh24:mi:ss.ff')
????)
????//???????
????SELECT
????CUSTID??
????TO_CHAR(UPDATETIMESTAMP??'syyyy-mm-dd hh24:mi:ss.ff') AS UPDATETIMESTAMP
????FROM tablename
????SQLSERVER?????????????
????CREATE FUNCTION [dbo].[UNIX_TIMESTAMP] (@ctimestamp datetime) RETURNS integer
????AS
????BEGIN
????/* Function body */
????declare @return integer
????SELECT @return = DATEDIFF(SECOND??{d '1970-01-01'}?? @ctimestamp)
????return @return
????END
????select * ??dbo.[UNIX_TIMESTAMP](createdate) from ??
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11