Grey_Wolf Posted October 5, 2005 Report Share Posted October 5, 2005 es domaaju par datumu parveidosanas pirms dabusanas ieksaa datubaazee - piem datums 01.02.03 - einu sazini kaa datubaze sho sapratiis. ar paarveidosanu ieksh datubazes pirms aaraa dabuusanas uzmaniigi - tur jaaskataas ka nesaanak paarveidot miljons datumus, lai gan vajag dabuut tikai 5cus smuki saformetus datumus. 24001[/snapback] mulkjiibas... elementarna vatson no PHP --> SQL $datums_bazei =date("Y-m-d H:i:s", $timestamps); VAI bazee pa taisno funkcija NOW() ja tekoshais mirklis SQL --> DATE_FORMAT(datums, '%m.%d.%Y') as noformets_datums noformets_datums --> 12.31.2005 UNIX_TIMESTAMP(datums) as noformets_datums noformets_datums --> unix formaataa ------- :P Link to comment Share on other sites More sharing options...
Roze Posted October 5, 2005 Report Share Posted October 5, 2005 Vispār jau vienmēr nāk talkā manuālis un "relax" =] You can specify DATETIME, DATE, and TIMESTAMP values using any of a common set of formats: As a string in either 'YYYY-MM-DD HH:MM:SS' or 'YY-MM-DD HH:MM:SS' format. A “relaxed” syntax is allowed: Any punctuation character may be used as the delimiter between date parts or time parts. For example, '98-12-31 11:30:45', '98.12.31 11+30+45', '98/12/31 11*30*45', and '98@12@31 11^30^45' are equivalent. As a string in either 'YYYY-MM-DD' or 'YY-MM-DD' format. A “relaxed” syntax is allowed here, too. For example, '98-12-31', '98.12.31', '98/12/31', and '98@12@31' are equivalent. As a string with no delimiters in either 'YYYYMMDDHHMMSS' or 'YYMMDDHHMMSS' format, provided that the string makes sense as a date. For example, '19970523091528' and '970523091528' are interpreted as '1997-05-23 09:15:28', but '971122129015' is illegal (it has a nonsensical minute part) and becomes '0000-00-00 00:00:00'. As a string with no delimiters in either 'YYYYMMDD' or 'YYMMDD' format, provided that the string makes sense as a date. For example, '19970523' and '970523' are interpreted as '1997-05-23', but '971332' is illegal (it has nonsensical month and day parts) and becomes '0000-00-00'. As a number in either YYYYMMDDHHMMSS or YYMMDDHHMMSS format, provided that the number makes sense as a date. For example, 19830905132800 and 830905132800 are interpreted as '1983-09-05 13:28:00'. As a number in either YYYYMMDD or YYMMDD format, provided that the number makes sense as a date. For example, 19830905 and 830905 are interpreted as '1983-09-05'. As the result of a function that returns a value that is acceptable in a DATETIME, DATE, or TIMESTAMP context, such as NOW() or CURRENT_DATE. http://dev.mysql.com/doc/mysql/en/datetime.html Link to comment Share on other sites More sharing options...
v3rb0 Posted October 5, 2005 Report Share Posted October 5, 2005 $datums_bazei =date("Y-m-d H:i:s", $timestamps); bet vai taa nav datuma paarveidosana ieliksanai datubaazei uz yyyy-mm-dd [hh:mm:ss] to tak ar piemineeju kaa vajadzibu peec mainigo tipu konvertesanu. Link to comment Share on other sites More sharing options...
Grey_Wolf Posted October 5, 2005 Report Share Posted October 5, 2005 to tak ar piemineeju kaa vajadzibu peec mainigo tipu konvertesanu. 24031[/snapback] un kaa tu parasti lietotaajam datumu izvadi Unix formaataa? :lol: ja man datums naak no usera (input) tad man ir uztaisiiti 3 selectboxi un no vinjiem dabunu dienu,menesi,gadu, - visu salieku vienaa stringaa un viss vadu iekshaa baazee.... vienkarshi uzraksti funkciju kurai padod _POST un kas atgriezj gliitu datuma stringu :) ja datums ir valiids un false ja ne Link to comment Share on other sites More sharing options...
v3rb0 Posted October 5, 2005 Report Share Posted October 5, 2005 Grey_Wolf: a vareetu pateikt kas tur nepareizs tajaa manaa apgalvojumaa ka datumu dazreiz vajag konververtet? staasti man te kaa pats validee un formee datuma tipus taa it kaa es buutu teicis ka to nevajag dariit.. :) Link to comment Share on other sites More sharing options...
goldy Posted October 5, 2005 Report Share Posted October 5, 2005 vai tad nepietiek ar: SELECT DATE_FORMAT(datums, '%d.%m.%Y'), lai no DB dabuutu datumu pareizaa formaataa, kapeec tur veel ieksaa jaajauc PHP Link to comment Share on other sites More sharing options...
Roze Posted October 5, 2005 Report Share Posted October 5, 2005 vai tad nepietiek ar:SELECT DATE_FORMAT(datums, '%d.%m.%Y'), lai no DB dabuutu datumu pareizaa formaataa, kapeec tur veel ieksaa jaajauc PHP 24044[/snapback] Doma manuprāt bija par dabūšanu iekšā ne ārā ;) Link to comment Share on other sites More sharing options...
Recommended Posts