Numero de semaine a partir d'une date
aziz
-
amazyo Messages postés 1 Date d'inscription Statut Membre Dernière intervention -
amazyo Messages postés 1 Date d'inscription Statut Membre Dernière intervention -
Bonjour,
je suis encore débutant sur access et je travail sur un fichier excel que j'ai exporté vers une BD access. En remplissant les champs de ma base j'aimerai creer un formulaire avec un champ qui me permettera de determiner le numero de la semaine d'une date existante sur ma base ( dans un champs de ma table ).
Pouvez vous m'aider svp
je suis encore débutant sur access et je travail sur un fichier excel que j'ai exporté vers une BD access. En remplissant les champs de ma base j'aimerai creer un formulaire avec un champ qui me permettera de determiner le numero de la semaine d'une date existante sur ma base ( dans un champs de ma table ).
Pouvez vous m'aider svp
A voir également:
- Numero de semaine a partir d'une date
- Numero prive - Guide
- Numéro père noël whatsapp - Accueil - Messagerie instantanée
- Creer un groupe whatsapp a partir d'un autre groupe - Guide
- Comment faire une recherche à partir d'une photo - Guide
- Numero clavier ✓ - Forum Bureautique
2 réponses
Bonjour
Dans une requete tu ajoutes ceci:
Semaine: Format([Ton champ Date];"ee")
C'est un nouveau champ
Dans une requete tu ajoutes ceci:
Semaine: Format([Ton champ Date];"ee")
C'est un nouveau champ
Oui en faite j'ai travaillé sur un algorithme que j'ai développé par la suite en c# le voici :
string date = "01/01/" + kryptonDateTimePicker1.Value.Year;
DateTime test = new DateTime();
test = Convert.ToDateTime(date);
int a = 0;
if (test.DayOfWeek.ToString() == "Monday")
{ a = 1; }
else if (test.DayOfWeek.ToString() == "Tuesday")
{ a = 2; }
else if (test.DayOfWeek.ToString() == "Wednesday")
{ a = 3; }
else if (test.DayOfWeek.ToString() == "Thursday")
{ a = 4; }
else if (test.DayOfWeek.ToString() == "Friday")
{ a = 5; }
else if (test.DayOfWeek.ToString() == "Saturday")
{ a = 6; }
else if (test.DayOfWeek.ToString() == "Sunday")
{ a = 7; }
int x = Convert.ToInt32(kryptonDateTimePicker1.Value.DayOfYear);
float y = (Convert.ToInt32(kryptonDateTimePicker1.Value.DayOfYear) + a - 1);
y = y / 7;
float z;
int diff = 0;
if (y <= 1)
{
textBox1.Text = "S" + 1;
}
else if (y > 1 )
{
diff = Convert.ToInt32(y);
z = y - (Convert.ToInt32(y));
if (z == 0)
{
textBox1.Text = "S" + (int)y;
}
else
{
textBox1.Text = "S" + ((int)y +1);
}
}
ce ci marche tres tres bien et je pense que c'est simple a comprendre, si vous le testez chez vous et que sa marche veuillez le poster sur d'autres forums. si vous avez besoin d'une explication veuillez me contacter.
Salam
string date = "01/01/" + kryptonDateTimePicker1.Value.Year;
DateTime test = new DateTime();
test = Convert.ToDateTime(date);
int a = 0;
if (test.DayOfWeek.ToString() == "Monday")
{ a = 1; }
else if (test.DayOfWeek.ToString() == "Tuesday")
{ a = 2; }
else if (test.DayOfWeek.ToString() == "Wednesday")
{ a = 3; }
else if (test.DayOfWeek.ToString() == "Thursday")
{ a = 4; }
else if (test.DayOfWeek.ToString() == "Friday")
{ a = 5; }
else if (test.DayOfWeek.ToString() == "Saturday")
{ a = 6; }
else if (test.DayOfWeek.ToString() == "Sunday")
{ a = 7; }
int x = Convert.ToInt32(kryptonDateTimePicker1.Value.DayOfYear);
float y = (Convert.ToInt32(kryptonDateTimePicker1.Value.DayOfYear) + a - 1);
y = y / 7;
float z;
int diff = 0;
if (y <= 1)
{
textBox1.Text = "S" + 1;
}
else if (y > 1 )
{
diff = Convert.ToInt32(y);
z = y - (Convert.ToInt32(y));
if (z == 0)
{
textBox1.Text = "S" + (int)y;
}
else
{
textBox1.Text = "S" + ((int)y +1);
}
}
ce ci marche tres tres bien et je pense que c'est simple a comprendre, si vous le testez chez vous et que sa marche veuillez le poster sur d'autres forums. si vous avez besoin d'une explication veuillez me contacter.
Salam