|
You last visited: Today at 09:23
Advertisement
[Help]Time format
Discussion on [Help]Time format within the Flyff Private Server forum part of the Flyff category.
03/31/2015, 00:41
|
#1
|
elite*gold: 0
Join Date: Dec 2008
Posts: 306
Received Thanks: 59
|
[Help]Time format
how to convert time 20150331031428 to normal datetime with php code sir.

|
|
|
03/31/2015, 01:14
|
#2
|
elite*gold: 0
Join Date: Jan 2009
Posts: 1,741
Received Thanks: 1,674
|
In PHP, substr() is your weapon of choice:
PHP Code:
$rawtime = '20150331031428'; // unconverted datetime string
$year = substr($rawtime, 0, 4); $month = substr($rawtime, 4, 2); $day = substr($rawtime, 6, 2); $hour = substr($rawtime, 8, 2); $minute = substr($rawtime, 10, 2); $second = substr($rawtime, 12, 2);
// stick them all together to get your datetime format $datetime = "$year-$month-$day $hour:$minute:$second.000"; // .000 is optional.
But you can do it much more easy when you use SQL functions:
Code:
CREATE function [dbo].[getdatetime]
(
@s_date varchar(14)
)
returns varchar(19)
as
begin
declare @c_date varchar(19)
select @c_date = convert(varchar(19),
substring(@s_date,1,4) + '-' +
substring(@s_date,5,2) + '-' +
substring(@s_date,7,2) + ' ' +
substring(@s_date,9,2) + ':' +
substring(@s_date,11,2) + ':' +
CASE substring(@s_date,13,2) WHEN '' THEN '00' ELSE substring(@s_date,13,2) END
)
return @c_date
end
You can get the actual datetime like that:
Code:
select dbo.getdatetime('20150331031428') as convdate
So, if you are getting logs from LOGGING_01_DBF, you can do it like this:
This is my latest item log with (unconverted) s_date column.
Rewrite the query to use the function.
Easily done.
|
|
|
03/31/2015, 16:13
|
#3
|
elite*gold: 0
Join Date: Dec 2008
Posts: 306
Received Thanks: 59
|
Quote:
Originally Posted by xTwiLightx
In PHP, substr() is your weapon of choice:
PHP Code:
$rawtime = '20150331031428'; // unconverted datetime string
$year = substr($rawtime, 0, 4);
$month = substr($rawtime, 4, 2);
$day = substr($rawtime, 6, 2);
$hour = substr($rawtime, 8, 2);
$minute = substr($rawtime, 10, 2);
$second = substr($rawtime, 12, 2);
// stick them all together to get your datetime format
$datetime = "$year-$month-$day $hour:$minute:$second.000"; // .000 is optional.
But you can do it much more easy when you use SQL functions:
Code:
CREATE function [dbo].[getdatetime]
(
@s_date varchar(14)
)
returns varchar(19)
as
begin
declare @c_date varchar(19)
select @c_date = convert(varchar(19),
substring(@s_date,1,4) + '-' +
substring(@s_date,5,2) + '-' +
substring(@s_date,7,2) + ' ' +
substring(@s_date,9,2) + ':' +
substring(@s_date,11,2) + ':' +
CASE substring(@s_date,13,2) WHEN '' THEN '00' ELSE substring(@s_date,13,2) END
)
return @c_date
end
You can get the actual datetime like that:
Code:
select dbo.getdatetime('20150331031428') as convdate
So, if you are getting logs from LOGGING_01_DBF, you can do it like this:
This is my latest item log with (unconverted) s_date column.
Rewrite the query to use the function.
Easily done. 
|
Thank you so much
|
|
|
 |
Similar Threads
|
Amc-Datei-Format in Conf-Datei-Format konvertieren
01/01/2014 - Technical Support - 5 Replies
Hallo allerseits,
ich benötige Hilfe mit meiner Sharkoon Drakonia Gaming Maus.
Wenn man bei dieser Maus die Makros bzw. Profile speichert,
muss man diese als Einzeldatei (Configure = .conf) irgendwo abspeichern.
Es gibt nicht wie bei anderen Gaming Mäusen einen Makro-Ordner.
Ich kann nur die Profile einzelnd laden, welche .conf-Dateien- und .amc-Dateien, wie bei den meisten anderen Mäusen, sind.
Daher frage ich mich, ob mir hier irgendwer, ohne irrelevante Beiträge, irgendwie...
|
PE Format
09/18/2011 - Coding Tutorials - 3 Replies
und hallo! :D
ich habe ewig nach infos zum pe format gesucht aber nur sehr mühsam und nach langer zeit gefunden was ich brauchte!
genau aus dem grund schreibe ich hier meine erfahrungen zum thema PE, es soll kein tutorial werden, nur eine kleine übersicht!
ich werde auch kleine c++ codesnippets mit einfügen!
okey wie fang ich an... ich denke erstmal mit einer kleinen liste was ich alles schreibe:
- der dos header
- der nt header
- die sections
(hm das is weniger als ich gedacht habe...
|
.wdf format
01/23/2006 - Conquer Online 2 - 0 Replies
I need viewer or decrypter .... What s program !
|
All times are GMT +1. The time now is 09:23.
|
|