Forum |  HardWare.fr | News | Articles | PC | S'identifier | S'inscrire | Shop Recherche
1484 connectés 

  FORUM HardWare.fr
  Programmation
  PHP

  convertir une date

 


 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

convertir une date

n°1286546
spoque
Posté le 18-01-2006 à 13:47:39  profilanswer
 

Bonjour,
 
problème de convertion
 
voici mon code:
 
<?$current_year = $_GET['date'];
echo $current_year;
?>
 
le echo m'affiche exemple:20060118
 
J'aimerais qu'il m'affiche 2006-01-18  
 
J'ai essayer avec ceci mais sans succès.
 
<?php  
function GetMyDate($date) {  
 
list($day,$month,$year) = explode("-",$date);  
$MyDate = $year."-".$month."-".$day;  
return $MyDate;  
 
}  
?>  
 
 
Merci
 
 
 
 

mood
Publicité
Posté le 18-01-2006 à 13:47:39  profilanswer
 

n°1286570
anapajari
s/travail/glanding on hfr/gs;
Posté le 18-01-2006 à 14:03:20  profilanswer
 

fais un truc dans le genre:

Code :
  1. function GetMyDate($str){
  2. return date('Y-m-d', mktime(0,0,0,substr($str,4,2), substr($str,-2), substr($str,0,4)));
  3. }


L'avantage de faier un date de mktime plutôt que de juste renvoyer la concaténation des trois champs c'est que si par hasard tu as '20060631' comme date, la fonction te renverras '2006-07-01'

n°1286595
Dj YeLL
$question = $to_be || !$to_be;
Posté le 18-01-2006 à 14:23:39  profilanswer
 

Il vient d'où ton $_GET['date'] ?

Message cité 1 fois
Message édité par Dj YeLL le 18-01-2006 à 14:23:46

---------------
Gamertag: CoteBlack YeLL
n°1286618
spoque
Posté le 18-01-2006 à 14:44:37  profilanswer
 

Dj YeLL a écrit :

Il vient d'où ton $_GET['date'] ?


 
 
D'un calendrier en php

n°1286622
spoque
Posté le 18-01-2006 à 14:45:41  profilanswer
 

anapajari a écrit :

fais un truc dans le genre:

Code :
  1. function GetMyDate($str){
  2. return date('Y-m-d', mktime(0,0,0,substr($str,4,2), substr($str,-2), substr($str,0,4)));
  3. }


L'avantage de faier un date de mktime plutôt que de juste renvoyer la concaténation des trois champs c'est que si par hasard tu as '20060631' comme date, la fonction te renverras '2006-07-01'


 
Merci mais même avec ceci sa ne fonctionne pas.

n°1286634
anapajari
s/travail/glanding on hfr/gs;
Posté le 18-01-2006 à 14:49:49  profilanswer
 

spoque a écrit :

Merci mais même avec ceci sa ne fonctionne pas.


Nawak [:pingouino]
 

Code :
  1. <?php
  2. function GetMyDate($str){
  3.   return date('Y-m-d', mktime(0,0,0,substr($str,4,2), substr($str,-2), substr($str,0,4)));
  4. }
  5. $a = '20060118';
  6. $b = '20060132';
  7. print GetMyDate($a)."\n";
  8. print GetMyDate($b)."\n";
  9. ?>


Affiche

Code :
  1. 2006-01-18
  2. 2006-02-01


n°1286637
spoque
Posté le 18-01-2006 à 14:53:10  profilanswer
 

anapajari a écrit :

Nawak [:pingouino]
 

Code :
  1. <?php
  2. function GetMyDate($str){
  3.   return date('Y-m-d', mktime(0,0,0,substr($str,4,2), substr($str,-2), substr($str,0,4)));
  4. }
  5. $a = '20060118';
  6. $b = '20060132';
  7. print GetMyDate($a)."\n";
  8. print GetMyDate($b)."\n";
  9. ?>


Affiche

Code :
  1. 2006-01-18
  2. 2006-02-01



 
 
 
 
Voici le calendrier en php mais iposible de changer le format:
 
 
 

Code :
  1. <?php
  2. ### French Version
  3. $calendar_txt['french']['monthes']      = array('', 'Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet',
  4.           'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre');
  5. $calendar_txt['french']['days']      = array('Lundi', 'Mardi', 'Mercredi','Jeudi', 'Vendredi', 'Samedi', 'Dimanche');
  6. $calendar_txt['french']['first_day']    = 0;
  7. $calendar_txt['french']['misc']      = array('Mois précédent', 'Mois suivant','Jour précédent', 'Jour suivant');
  8. ### English version
  9. $calendar_txt['english']['monthes']     = array('', 'January', 'February', 'March', 'April', 'May', 'June', 'July',
  10.           'August', 'September', 'October','November', 'December');
  11. $calendar_txt['english']['days']     = array('Monday', 'Tuesday', 'Wednesday','Thursday', 'Friday', 'Saturday','Sunday');
  12. $calendar_txt['english']['first_day']   = -1;
  13. $calendar_txt['english']['misc']        = array('Previous month', 'Next month', 'Previous day', 'Next day');
  14. ### Spanish version
  15. $calendar_txt['spanish']['monthes']     = array('', 'Enero', 'Febrero', 'Marzo', 'Abril', 'Mayo', 'Junio', 'Julio',
  16.           'Agosto', 'Septiembre', 'Octubre', 'Noviembre', 'Diciembre');
  17. $calendar_txt['spanish']['days']        = array('Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado', 'Domingo');
  18. $calendar_txt['spanish']['first_day']   = 0;
  19. $calendar_txt['spanish']['misc']        = array('Mes anterior', 'Mes próximo', 'día anterior', 'día siguiente');
  20. ### German version
  21. $calendar_txt['german']['monthes']     = array('', 'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli',
  22.           'August', 'September', 'Oktober','November', 'Dezember');
  23. $calendar_txt['german']['days']         = array('Montag', 'Dienstag', 'Mittwoch', 'Donnerstag','Freitag','Samstag', 'Sonntag');
  24. $calendar_txt['german']['first_day']    = 0;
  25. $calendar_txt['german']['misc']         = array('Vorhergehender Monat', 'Folgender Monat', 'Vorabend', 'Am nächsten Tag');
  26. function calendar($date = '') {
  27. Global $link_on_day, $PHP_SELF, $params;
  28. Global $HTTP_POST_VARS, $HTTP_GET_VARS;
  29. Global $calendar_txt;
  30. ### Default Params
  31. $param_d['calendar_id']   = 1; // Calendar ID
  32. $param_d['calendar_columns']  = 5; // Nb of columns
  33. $param_d['show_day']    = 0; // Show the day bar
  34. $param_d['show_month']   = 1; // Show the month bar
  35. $param_d['nav_link']   = 1; // Add a nav bar below
  36. $param_d['link_after_date']  = 0; // Enable link on days after the current day
  37. $param_d['link_before_date'] = 1; // Enable link on days before the current day
  38. $param_d['link_on_day']   = $PHP_SELF.'?date=%%dd%%'; // Link to put on each day
  39. $param_d['font_face']   = 'Verdana, Arial, Helvetica'; // Default font to use
  40. $param_d['font_size']   = 10; // Font size in px
  41. $param_d['bg_color']   = '#FFFFFF';
  42. $param_d['today_bg_color']  = '#A0C0C0';
  43. $param_d['font_today_color'] = '#990000';
  44. $param_d['font_color']   = '#000000';
  45. $param_d['font_nav_bg_color'] = '#A9B4B3';
  46. $param_d['font_nav_color']  = '#FFFFFF';
  47. $param_d['font_header_color'] = '#FFFFFF';
  48. $param_d['border_color']  = '#2798C4';
  49. $param_d['use_img']    = 1; // Use gif for nav bar on the bottom
  50. ### New params V2
  51. $param_d['lang']    = 'english';
  52. $param_d['font_highlight_color']= '#FF0000';
  53. $param_d['bg_highlight_color']  = '#00FF00';
  54. $param_d['day_mode']   = 0;
  55. $param_d['time_step']   = 30;
  56. $param_d['time_start']   = '0:00';
  57. $param_d['time_stop']   = '24:00';
  58. $param_d['highlight']   = array();
  59.     // Can be 'hightlight' or 'text'
  60.     $param_d['highlight_type']      = 'highlight';
  61.     $param_d['cell_width']          = 20;
  62.     $param_d['cell_height']         = 20;
  63.     $param_d['short_day_name']      = 1;
  64.     $param_d['link_on_hour']        = $PHP_SELF.'?hour=%%hh%%';
  65. ### /Params
  66. ### Getting all params
  67. while (list($key, $val) = each($param_d)) {
  68.  if (isset($params[$key])) {
  69.   $param[$key] = $params[$key];
  70.  }
  71.  else {
  72.   $param[$key] = $param_d[$key];
  73.  }
  74. }
  75. $monthes_name = $calendar_txt[$param['lang']]['monthes'];
  76. $param['calendar_columns'] = ($param['show_day']) ? 7 : $param['calendar_columns'];
  77.    
  78.     $date = priv_reg_glob_calendar('date');
  79. if ($date == '') {
  80.  $timestamp = time();
  81. }
  82. else {
  83.  $month   = substr($date, 4 ,2);
  84.  $day   = substr($date, 6, 2);
  85.  $year  = substr($date, 0 ,4);
  86.  $timestamp  = mktime(0, 0, 0, $month, $day, $year);
  87. }
  88.    
  89.    
  90. $current_day   = date("d", $timestamp);
  91. $current_month   = date("n", $timestamp);
  92. $current_month_2 = date("m", $timestamp);
  93. $current_year   = date("Y", $timestamp);
  94.     $first_decalage  = date("w", mktime(0, 0, 0, $current_month, 1, $current_year));
  95. ### Sunday is the _LAST_ day
  96. $first_decalage  = ( $first_decalage == 0 ) ? 6 : $first_decalage;
  97. $current_day_index = date('w', $timestamp) + $calendar_txt[$param['lang']]['first_day'] - 1;
  98. $current_day_index = ($current_day_index == -1) ? 7 : $current_day_index;
  99. $current_day_name = $calendar_txt[$param['lang']]['days'][$current_day_index];
  100. $current_month_name = $monthes_name[$current_month];
  101. $nb_days_month   = date("t", $timestamp);
  102. $current_timestamp  = mktime(23,59,59,date("m" ), date("d" ), date("Y" ));
  103. ### CSS
  104. $output  = '<style type="text/css">'."\n";
  105. $output .= '<!--'."\n";
  106. $output .= ' .calendarNav'.$param['calendar_id'].'  {  font-family: '.$param['font_face'].'; font-size: '.($param['font_size']-1).'px; font-style: normal; background-color: '.$param['border_color'].'}'."\n";
  107. $output .= ' .calendarTop'.$param['calendar_id'].'  {  font-family: '.$param['font_face'].'; font-size: '.($param['font_size']+1).'px; font-style: normal; color: '.$param['font_header_color'].'; font-weight: bold;  background-color: '.$param['border_color'].'}'."\n";
  108. $output .= ' .calendarToday'.$param['calendar_id'].' {  font-family: '.$param['font_face'].'; font-size: '.$param['font_size'].'px; font-weight: bold; color: '.$param['font_today_color'].'; background-color: '.$param['today_bg_color'].';}'."\n";
  109. $output .= ' .calendarDays'.$param['calendar_id'].'  {  width:'.$param['cell_width'].'; height:'.$param['cell_height'].'; font-family: '.$param['font_face'].'; font-size: '.$param['font_size'].'px; font-style: normal; color: '.$param['font_color'].'; background-color: '.$param['bg_color'].'; text-align: center}'."\n";
  110. $output .= ' .calendarHL'.$param['calendar_id'].'  {  width:'.$param['cell_width'].'; height:'.$param['cell_height'].';font-family: '.$param['font_face'].'; font-size: '.$param['font_size'].'px; font-style: normal; color: '.$param['font_highlight_color'].'; background-color: '.$param['bg_highlight_color'].'; text-align: center}'."\n";
  111. $output .= ' .calendarHeader'.$param['calendar_id'].'{  font-family: '.$param['font_face'].'; font-size: '.($param['font_size']-1).'px; background-color: '.$param['font_nav_bg_color'].'; color: '.$param['font_nav_color'].';}'."\n";
  112. $output .= ' .calendarTable'.$param['calendar_id'].' {  background-color: '.$param['border_color'].'; border: 1px '.$param['border_color'].' solid}'."\n";
  113. $output .= '-->'."\n";
  114. $output .= '</style>'."\n";
  115. $output .= '<table border="0" class="calendarTable'.$param['calendar_id'].'" cellpadding="2" cellspacing="1">'."\n";
  116. ### Displaying the current month/year
  117. if ($param['show_month'] == 1) {
  118.  $output .= '<tr>'."\n";
  119.  $output .= ' <td colspan="'.$param['calendar_columns'].'" align="center" class="calendarTop'.$param['calendar_id'].'">'."\n";
  120.  ### Insert an img at will
  121.  if ($param['use_img'] ) {
  122.   $output .= '<img src="cal/mois.gif">';
  123.  }
  124.  if ( $param['day_mode'] == 1 ) {
  125.   $output .= '  '.$current_day_name.' '.$current_day.' '.$current_month_name.' '.$current_year."\n";
  126.  }
  127.  else {
  128.   $output .= '  '.$current_month_name.' '.$current_year."\n";
  129.  }
  130.  $output .= ' </td>'."\n";
  131.  $output .= '</tr>'."\n";
  132. }
  133. ### Building the table row with the days
  134. if ($param['show_day'] == 1 && $param['day_mode'] == 0) {
  135.  $output .= '<tr align="center">'."\n";
  136.  $first_day = $calendar_txt[$param['lang']]['first_day'];
  137.  for ($i = $first_day; $i < 7 + $first_day; $i++) {
  138.   $index = ( $i >= 7) ? (7 + $i): $i;
  139.   $index = ($i < 0) ? (7 + $i) : $i;
  140.     
  141.             $day_name = ( $param['short_day_name'] == 1 ) ? substr($calendar_txt[$param['lang']]['days'][$index], 0, 1) : $calendar_txt[$param['lang']]['days'][$index];
  142.   $output .= ' <td class="calendarHeader'.$param['calendar_id'].'"><b>'.$day_name.'</b></td>'."\n";
  143.  }
  144.  $output .= '</tr>'."\n";
  145.  $first_decalage = $first_decalage - $calendar_txt[$param['lang']]['first_day'];
  146.  $first_decalage = ( $first_decalage > 7 ) ? $first_decalage - 7 : $first_decalage;
  147. }
  148. else {
  149.  $first_decalage = 0;
  150. }
  151. $output .= '<tr align="center">';
  152. $int_counter = 0;
  153. if ( $param['day_mode'] == 1 ) {
  154.  list($hour_start, $min_start)  = explode(':', $param['time_start']);
  155.  list($hour_end, $min_end)  = explode(':', $param['time_stop']);
  156.  $ts_start  = ( $hour_start * 60 ) + $min_start;
  157.  $ts_end  = ( $hour_end * 60 ) + $min_end;
  158.  $nb_steps = ceil( ($ts_end - $ts_start) / $param['time_step'] );
  159.  for ( $i = 0; $i <= $nb_steps; $i++ ) {
  160.             $current_ts  = ($ts_start) + $i * $param['time_step'];
  161.   $current_hour  = floor($current_ts / 60);
  162.   $current_min  = $current_ts % 60;
  163.   $current_hour  = (strlen($current_hour) < 2) ? '0'.$current_hour : $current_hour;
  164.   $current_min  = (strlen($current_min) < 2) ? '0'.$current_min : $current_min;
  165.       $highlight_current  = ( isset($param['highlight'][date('Ymd', $timestamp).$current_hour.$current_min]) );
  166.             $css_2_use          = ( $highlight_current ) ? 'HL' : 'Days';
  167.             $txt_2_use          = ( $highlight_current && $param['highlight_type'] == 'text') ? $param['highlight'][date('Ymd', $timestamp).$current_hour.$current_min] : '';
  168.   $output .= '<tr>'."\n";
  169.             if ( $param['link_on_hour'] != '') {
  170.                 $output .= ' <td class="calendar'.$css_2_use.$param['calendar_id'].'" width="10%"><a href="'.str_replace('%%hh%%', date('Ymd', $timestamp).$current_hour.$current_min, $param['link_on_hour']).'">'.$current_hour.':'.$current_min.'</a></td>'."\n";
  171.             }
  172.             else {
  173.                 $output .= ' <td class="calendar'.$css_2_use.$param['calendar_id'].'" width="10%">'.$current_hour.':'.$current_min.'</td>'."\n";
  174.             }
  175.   $output .= '    <td class="calendar'.$css_2_use.$param['calendar_id'].'">'.$txt_2_use.'</td> '."\n";
  176.   $output .= '</tr>'."\n";
  177.  }
  178. }
  179. else {
  180.  # Filling with empty cells at the begining
  181.  for ($i = 1; $i < $first_decalage; $i++) {
  182.   $output .= '<td class="calendarDays'.$param['calendar_id'].'">&nbsp;</td>'."\n";
  183.   $int_counter++;
  184.  }
  185.  ### Building the table
  186.  for ($i = 1; $i <= $nb_days_month; $i++) {
  187.   ### Do we highlight the current day ?
  188.   $i_2 = ($i < 10) ? '0'.$i : $i;
  189.      $highlight_current = ( isset($param['highlight'][date('Y-m', $timestamp).$i_2]) );
  190.   ### Row start
  191.   if ( ($i + $first_decalage) % $param['calendar_columns'] == 2 && $i != 1) {
  192.    $output .= '<tr align="center">'."\n";
  193.    $int_counter = 0;
  194.   }
  195.   $css_2_use = ( $highlight_current ) ? 'HL' : 'Days';
  196.             $txt_2_use = ( $highlight_current && $param['highlight_type'] == 'text') ? '<br>'.$param['highlight'][date('Y-m', $timestamp).$i_2] : '';
  197.            
  198.             if ($i == $current_day) {
  199.    $output .= '<td class="calendarToday'.$param['calendar_id'].'" align="center">'.$i.$txt_2_use.'</td>'."\n";
  200.   }
  201.   elseif ($param['link_on_day'] != '') {
  202.    $loop_timestamp = mktime(0,0,0, $current_month, $i, $current_year);
  203.    if (( ($param['link_after_date'] == 0) && ($current_timestamp < $loop_timestamp)) || (($param['link_before_date'] == 0) && ($current_timestamp >= $loop_timestamp)) ){
  204.     $output .= '<td class="calendar'.$css_2_use.$param['calendar_id'].'">'.$i.$txt_2_use.'</td>'."\n";
  205.    }
  206.    else {
  207.     $output .= '<td class="calendar'.$css_2_use.$param['calendar_id'].'"><a href="'.str_replace('%%dd%%', $current_year.$current_month_2.$i_2,$param['link_on_day']).'">'.$i.'</a>'.$txt_2_use.'</td>'."\n";
  208.    }
  209.   }
  210.   else {
  211.    $output .= '<td class="calendar'.$css_2_use.$param['calendar_id'].'">'.$i.'</td>'."\n";
  212.   }
  213.   $int_counter++;
  214.   ### Row end
  215.   if (  ($i + $first_decalage) % ($param['calendar_columns'] ) == 1 ) {
  216.    $output .= '</tr>'."\n";
  217.   }
  218.  }
  219.  $cell_missing = $param['calendar_columns'] - $int_counter;
  220.  for ($i = 0; $i < $cell_missing; $i++) {
  221.   $output .= '<td class="calendarDays'.$param['calendar_id'].'">&nbsp;</td>'."\n";
  222.  }
  223.  $output .= '</tr>'."\n";
  224. }
  225. ### Display the nav links on the bottom of the table
  226. if ($param['nav_link'] == 1) {
  227.  $previous_month = date("Ymd",
  228.        mktime( 12,
  229.          0,
  230.          0,
  231.          ($current_month - 1),
  232.          $current_day,
  233.          $current_year
  234.            )
  235.        );
  236.  $previous_day  = date("Ymd",
  237.        mktime( 12,
  238.          0,
  239.          0,
  240.          $current_month,
  241.          $current_day - 1,
  242.          $current_year
  243.            )
  244.        );
  245.  $next_day   = date("Ymd",
  246.        mktime( 1,
  247.          12,
  248.          0,
  249.          $current_month,
  250.          $current_day + 1,
  251.          $current_year
  252.            )
  253.        );
  254.  $next_month  = date("Ymd",
  255.        mktime( 1,
  256.          12,
  257.          0,
  258.          $current_month + 1,
  259.          $current_day,
  260.          $current_year
  261.            )
  262.        );
  263.  if ($param['use_img']) {
  264.   $g  = '<img src="cal/g.gif" border="0">';
  265.   $gg = '<img src="cal/gg.gif" border="0">';
  266.   $d  = '<img src="cal/d.gif" border="0">';
  267.   $dd = '<img src="cal/dd.gif" border="0">';
  268.  }
  269.  else {
  270.   $g  = '&lt;';
  271.   $gg = '&lt;&lt;';
  272.   $d = '&gt;';
  273.   $dd = '&gt;&gt;';
  274.  }
  275.  if ( ($param['link_after_date'] == 0)
  276.    && ($current_timestamp < mktime(0,0,0, $current_month, $current_day+1, $current_year))
  277.   ) {
  278.   $next_day_link = '&nbsp;';
  279.  }
  280.  else {
  281.   $next_day_link   = '<a href="'.$PHP_SELF.'?date='.$next_day.'" title="'.$calendar_txt[$param['lang']]['misc'][3].'">'.$d.'</a>'."\n";
  282.  }
  283.  if ( ($param['link_before_date'] == 0)
  284.    && ($current_timestamp > mktime(0,0,0, $current_month, $current_day-1, $current_year))
  285.   ){
  286.   $previous_day_link = '&nbsp;';
  287.  }
  288.  else {
  289.   $previous_day_link   = '<a href="'.$PHP_SELF.'?date='.$previous_day.'" title="'.$calendar_txt[$param['lang']]['misc'][2].'">'.$g.'</a>'."\n";
  290.  }
  291.  if ( ($param['link_after_date'] == 0)
  292.    && ($current_timestamp < mktime(0,0,0, $current_month+1, $current_day, $current_year))
  293.   ) {
  294.   $next_month_link = '&nbsp;';
  295.  }
  296.  else {
  297.   $next_month_link  = '<a href="'.$PHP_SELF.'?date='.$next_month.'" title="'.$calendar_txt[$param['lang']]['misc'][1].'">'.$dd.'</a>'."\n";
  298.  }
  299.  if  ( ($param['link_before_date'] == 0)
  300.    && ($current_timestamp >= mktime(0,0,0, $current_month-1, $current_day, $current_year))
  301.   ){
  302.   $previous_month_link = '&nbsp;';
  303.  }
  304.  else {
  305.   $previous_month_link  = '<a href="'.$PHP_SELF.'?date='.$previous_month.'" title="'.$calendar_txt[$param['lang']]['misc'][0].'">'.$gg.'</a>'."\n";
  306.  }
  307.  $output .= '<tr>'."\n";
  308.  $output .= ' <td colspan="'.$param['calendar_columns'].'" class="calendarDays'.$param['calendar_id'].'">'."\n";
  309.  $output .= '  <table width="100%" border="0" >';
  310.  $output .= '  <tr>'."\n";
  311.  $output .= '   <td width="25%" align="left" class="calendarDays'.$param['calendar_id'].'">'."\n";
  312.  $output .=      $previous_month_link;
  313.  $output .= '   </td>'."\n";
  314.  $output .= '   <td width="25%" align="center" class="calendarDays'.$param['calendar_id'].'">'."\n";
  315.  $output .=      $previous_day_link;
  316.  $output .= '   </td>'."\n";
  317.  $output .= '   <td width="25%" align="center" class="calendarDays'.$param['calendar_id'].'">'."\n";
  318.  $output .=      $next_day_link;
  319.  $output .= '   </td>'."\n";
  320.  $output .= '   <td width="25%" align="right" class="calendarDays'.$param['calendar_id'].'">'."\n";
  321.  $output .=      $next_month_link;
  322.  $output .= '   </td>'."\n";
  323.  $output .= '  </tr>';
  324.  $output .= '  </table>';
  325.  $output .= ' </td>'."\n";
  326.  $output .= '</tr>'."\n";
  327. }
  328. $output .= '</table>'."\n";
  329. return $output;
  330. }
  331. function priv_reg_glob_calendar($var) {
  332. Global $HTTP_GET_VARS, $HTTP_POST_VARS;
  333. if (isset($HTTP_GET_VARS[$var])) {
  334.  return $HTTP_GET_VARS[$var];
  335. }
  336. elseif (isset($HTTP_POST_VARS[$var])) {
  337.  return $HTTP_POST_VARS[$var];
  338. }
  339. else {
  340.  return '';
  341. }
  342. }
  343. ?>


 
 
 

n°1286638
spoque
Posté le 18-01-2006 à 14:54:38  profilanswer
 

spoque a écrit :

D'un calendrier en php


 
 
Le GET viens de ce calendrier sa fait maintenant 3 jours que j'essaye de changer le format mais imposible!!!

n°1286639
Dj YeLL
$question = $to_be || !$to_be;
Posté le 18-01-2006 à 14:54:48  profilanswer
 

Ca fait bcp de substr et autre juste pour ça :D
 
Tiens, mets ça :
 

Code :
  1. $maDate = date('Y-m-d',strtotime($_GET['date']));


---------------
Gamertag: CoteBlack YeLL
n°1286644
spoque
Posté le 18-01-2006 à 14:59:02  profilanswer
 

Dj YeLL a écrit :

Ca fait bcp de substr et autre juste pour ça :D
 
Tiens, mets ça :
 

Code :
  1. $maDate = date('Y-m-d',strtotime($_GET['date']));



 
 
SUPER merci mille fois DJ Yell sa fonctionne!!!!
 
Très bonne journée

mood
Publicité
Posté le 18-01-2006 à 14:59:02  profilanswer
 

n°1286717
Dj YeLL
$question = $to_be || !$to_be;
Posté le 18-01-2006 à 16:16:24  profilanswer
 

:jap:


---------------
Gamertag: CoteBlack YeLL

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Programmation
  PHP

  convertir une date

 

Sujets relatifs
convertir une date vers un entierConvertir un " Largeinteger" en date
[C] - Convertir un timestamp en dateconvertir un time() en date normale
SYBASE: comment convertir une date en un autre format date?[access] Ds une requete, convertir un champ texte en date
Convertir un string en format dateDate stockée au format strtotime, comment convertir ?
convertir une date[PHP] convertir date fr type 27/02/2001 en timestamp unix correct
Plus de sujets relatifs à : convertir une date


Copyright © 1997-2022 Hardware.fr SARL (Signaler un contenu illicite / Données personnelles) / Groupe LDLC / Shop HFR