Results 1 to 3 of 3

Thread: Get the right Date format

  1. #1
    Join Date
    Jan 2007
    Posts
    2

    Question Get the right Date format

    I am trying to retreive a date as a string in matlab, the SQL...
    "SELECT FORMAT(execution_time +10, ''YYYYWW'') from my_table"

    ...gives me "20071", and I want it to be 200701 to avoid duplicate questions when I make comparison.

    How do I force Access not to drop the zero?

  2. #2
    Join Date
    Apr 2006
    Posts
    30
    Code:
    SELECT DatePart("yyyy", execution_time +10)*100 +DatePart("ww", execution_time +10)
    from myTable

  3. #3
    Join Date
    Jan 2007
    Posts
    2
    Thanks! Works great!

    But it gave me a new problem
    How do I specify Access to use ISO standard "week of year" numbering?

    (2005-01-01 (YYYY-MM-DD) is a saturday)

    DatePart(''W'',DateValue(''2005-01-01'')) gives "1" but it should be "53" according to ISO 8601
    Last edited by nordav; 01-17-2007 at 09:03 AM. Reason: I was wrong

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •