Raised This Month: $ Target: $400
 0% 

SQL Column Type


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
EclipseCP
BANNED
Join Date: Dec 2010
Old 03-17-2011 , 21:52   SQL Column Type
Reply With Quote #1

hi , sorry for my bad english..

i have this code in menu:

PHP Code:
new day[11], hour[11]

format_time(daycharsmax(day), "%d/%m/%Y"g_day[id])
format_time(hourcharsmax(hour), "%H:%M:%S"g_day[id])

formatex(menucharsmax(menu), "Day: %d - Hour: %d"dayhour
as i have a record of accounts, the creation of the account, establishing the date (day and time)

PHP Code:
g_day[id] = get_systime()
formatex(consultcharsmax(consult), "UPDATE `%s` SET `character` = '%s', `date` = '%d' WHERE `acc` = '%s'"SQL_TABLEg_name[id], g_day[id], g_name2[id]) 


In short, I just want to know what type of SQL column is `date`, because it keeps the date and time, the truth would be grateful if I can help
EclipseCP is offline
katna
Senior Member
Join Date: May 2010
Old 03-18-2011 , 05:36   Re: SQL Column Type
Reply With Quote #2

SQL COLUMNS:
PHP Code:
DATEdate without the time
DATETIME
date with time 
Example:
PHP Code:
CREATE TABLE `testing` (
  `
idINT(11AUTO_INCREMENT,
  `
namevarchar(64),
  `
dateDATETIME,
  
PRIMARY KEY (id)
); 
Datetime format is: yyyy-mm-dd hh-mm-ss ( 2011-18-03 123:01 )
katna is offline
EclipseCP
BANNED
Join Date: Dec 2010
Old 03-18-2011 , 14:51   Re: SQL Column Type
Reply With Quote #3

hello

I tested it, and leaves in 1895 or something like that O.O also wonder if you will not see the problem, so:

in the DB appears between LINES date (dd-mm-yy-), and I want to appear between / it so it would appear on the menu, any way?
EclipseCP is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 03-18-2011 , 18:48   Re: SQL Column Type
Reply With Quote #4

When you get date from sql, you can replace - with / using replace_all.
Information about dates in sql: http://www.w3schools.com/sql/sql_dates.asp
__________________
Impossible is Nothing
Sylwester is offline
EclipseCP
BANNED
Join Date: Dec 2010
Old 03-18-2011 , 20:43   Re: SQL Column Type
Reply With Quote #5

Quote:
Originally Posted by Sylwester View Post
When you get date from sql, you can replace - with / using replace_all.
Information about dates in sql: http://www.w3schools.com/sql/sql_dates.asp
Hello, your answer helped me

I am a relative novice in SQL, is more or less but would query for a format time set a column?

Greetings
EclipseCP is offline
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 03-18-2011 , 21:49   Re: SQL Column Type
Reply With Quote #6

I'm not sure what do you mean, but if you want to assign value to a "DATETIME" type column, then you can use this:
PHP Code:
format(...,"INSERT INTO table_name (column_name) VALUES (DATE_SUB(NOW(), INTERVAL %d SECOND));"time_now-time_in_the_past
column_name is supposed to store some date in the past.
"SECOND" can be replaced with other type ( see this list ), but must match type used by time_now and time_in_the_past.
__________________
Impossible is Nothing
Sylwester is offline
EclipseCP
BANNED
Join Date: Dec 2010
Old 03-19-2011 , 22:16   Re: SQL Column Type
Reply With Quote #7

Hello.

Shoot me syntax error. Using version 3.3.9.2 PHPMYADMIN remote connection.

What i do is convert a column format: %d %b %Y %T: %f

From here I took the format: http://www.w3schools.com/sql/func_date_format.asp

Greetings
EclipseCP is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 14:39.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode