---
title: "Datumfunktion"
type: "forum-thread"
url: "https://www.webforum.nu/amne/databaser-sql/22093-datumfunktion"
topic: "Databaser & SQL"
topic_url: "https://www.webforum.nu/amne/databaser-sql"
author: "Marcus"
published: "2001-04-09T09:42:00.000Z"
updated: "2001-04-09T11:36:00.000Z"
replies: 2
views: 236
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/databaser-sql/22093-datumfunktion"
---

# Datumfunktion

## #1 — Marcus, 2001-04-09T09:42Z

Hur kan man på ett smidigt sätt få reda på vilken vecka det är? T.ex. I databasen står det 2001-04-09, kan jag på något sätt få fram vilken vecka detta är?

Permalänk: https://www.webforum.nu/p/22093

## #2 — LarsG, 2001-04-09T10:45Z

Ur mysqls dokumentation

WEEK(date) 
WEEK(date,first) 
With a single argument, returns the week for date, in the range 0 to 53 (yes, there may be the beginnings of a week 53), for locations where Sunday is the first day of the week. The two-argument form of WEEK() allows you to specify whether the week starts on Sunday or Monday. The week starts on Sunday if the second argument is 0, on Monday if the second argument is 1: 

mysql\> select WEEK('1998-02-20');
        \-\> 7
mysql\> select WEEK('1998-02-20',0);
        \-\> 7

Permalänk: https://www.webforum.nu/p/354355

## #3 — Marcus, 2001-04-09T11:36Z

Tack så mycket.

Permalänk: https://www.webforum.nu/p/354356

---

Tråden på webben: https://www.webforum.nu/amne/databaser-sql/22093-datumfunktion
