Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Flyff > Flyff Private Server
You last visited: Today at 09:23

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Help]Time format

Discussion on [Help]Time format within the Flyff Private Server forum part of the Flyff category.

Reply
 
Old   #1
 
banktakung's Avatar
 
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.

banktakung is offline  
Old 03/31/2015, 01:14   #2
 
xTwiLightx's Avatar
 
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($rawtime04);
$month substr($rawtime42);
$day substr($rawtime62);
$hour substr($rawtime82);
$minute substr($rawtime102);
$second substr($rawtime122);

// 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.
xTwiLightx is offline  
Old 03/31/2015, 16:13   #3
 
banktakung's Avatar
 
elite*gold: 0
Join Date: Dec 2008
Posts: 306
Received Thanks: 59
Quote:
Originally Posted by xTwiLightx View Post
In PHP, substr() is your weapon of choice:


PHP Code:
$rawtime '20150331031428'// unconverted datetime string

$year substr($rawtime04);
$month substr($rawtime42);
$day substr($rawtime62);
$hour substr($rawtime82);
$minute substr($rawtime102);
$second substr($rawtime122);

// 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
banktakung is offline  
Reply


Similar Threads 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.


Powered by vBulletin®
Copyright ©2000 - 2026, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2026 elitepvpers All Rights Reserved.