Current week in datagridview headers

Hi Guys, with my code below I'm able to get the week days with datetime in datagridview column headers, but as the days goes, this columns keep changing date forward. how can I adjust this columns to keep current week days with date from sunday
to saturady without changing forward ? appreciated
Dim mydate As DateTime, str1 As String
Dim dayname As String = Date.Today.DayOfWeek.ToString()
Dim datevalue As Date
mydate = Now
For i = 0 To columns.Length - 1
Dim col As DataGridViewColumn = New DataGridViewTextBoxColumn()
mydate = DateTime.Today.AddDays(+i)
datevalue = mydate
str1 = datevalue.DayOfWeek.ToString
col.HeaderText = str1 & " " & mydate.ToString("d")
columns(i) = col
Next
Me.DataGridView1.Columns.AddRange(columns)
thanks

Yes it worked, thanks a lot. here is my code
Dim mydate As DateTime, str1 As String
Dim datevalue As Date
Dim columns As DataGridViewColumn() = New DataGridViewColumn(6) {}
For i = 0 To columns.Length - 1
Dim col As DataGridViewColumn = New DataGridViewTextBoxColumn()
Dim DateSunday As Date = Now.AddDays(-1.0 * CDbl(Now.DayOfWeek))
mydate = DateSunday.AddDays(+i)
datevalue = mydate
str1 = mydate.DayOfWeek.ToString
col.HeaderText = str1 & " " & mydate.ToString("d")
columns(i) = col
Next
Me.DataGridView1.Columns.AddRange(columns)

Similar Messages

  • How to get data for current week and previous week using customer exit in Bex.

    Hi everyone,
    I have a scenario in which I need to display data for current week and previous week (based on "sy_datum" the program has to calculate current week and previous week) in Bex using  Customer exit. I have created one variable in Bex Query Designer and I have written code for the variable in CMOD. But it is not working fine, (I know that we can do the same by using offset value in Bex). Can some one guide me how to achieve my requirement using customer exit.
    Thanks in Advance,
    G S Ramanjaneyulu.

    Hi krishna,
    Thanks for your quick reply, can you have a look at my code,
    case i_vnam.
    WHEN 'ZPWK_CWK'.
    ranges : pre_week for sy-datum.
    data : start_date type DATS,
           end_date TYPE dats .
    ************FM TO GET FIRST DATE OF CURRENT WEEK ************************
    CALL FUNCTION 'BWSO_DATE_GET_FIRST_WEEKDAY'
      EXPORTING
        DATE_IN  = sy-datum
      IMPORTING
        DATE_OUT = start_date.   " WEEK FIRST DATE
    end_date = START_DATE + 6.   " WEEK LAST DATE
    END_DATE   = START_DATE - 1.   " PREVIOUS WEEK END DATE
    START_DATE = START_DATE - 7.   " PREVIOUS WEEK START  DATE
    **********PREVIOUS WEEK DATES IN PRE_WEEK******************
    pre_week-SIGN   = 'I'.
    pre_week-option = 'BT'.
    pre_week-LOW    = START_DATE.
    pre_week-HIGH   = END_DATE.
    APPEND  pre_week.
    CLEAR : START_DATE,END_DATE.
    endcase.
    Regards,
    G S Ramanjaneyulu.

  • Create an Activity Report for Current Week

    I would like to create a activity report for the current week. The trick is that if the weekday is Wednesday or earlier (Sunday being the first day of the week), the report shows last week's activities; but if the weekday is Thursday or later (Saturday being the last day of the week), the report shows the current weeks activities.
    I have a filter that works in Access but does not seem to work in Siebel. It does just what I explained above:
    Between CDate(Int((IIf(Weekday(Now())<=4,Now()-(6+Weekday(Now())),Now()-(Weekday(Now())-1))))) And CDate(Int((IIf(Weekday(Now())<=4,Now()-Weekday(Now()),Now()+(7-Weekday(Now()))))))
    Thank you,
    David
    Edited by: DavidE on Oct 7, 2008 4:17 PM

    David,
    try this:
    case DAYOFWEEK(CAST(Activity."Planned Start Time" AS date))when 1 then timestampadd(sql_tsi_day,1,CAST(Activity."Planned Start Time" AS date)) when 3 then timestampadd(sql_tsi_day,-1,CAST(Activity."Planned Start Time" AS date)) when 4 then timestampadd(sql_tsi_day,-2,CAST(Activity."Planned Start Time" AS date)) when 5 then timestampadd(sql_tsi_day,-3,CAST(Activity."Planned Start Time" AS date)) when 6 then timestampadd(sql_tsi_day,-4,CAST(Activity."Planned Start Time" AS date)) when 7 then timestampadd(sql_tsi_day,-5,CAST(Activity."Planned Start Time" AS date)) else CAST(Activity."Planned Start Time" AS date) end
    This gave me the sunday of the week. You should be able to modify this format for your purposes.
    cheers
    Alex

  • Limit values shown in Parameter based on current week

    We have a requirement wherein a parameter can be chosen depending on the current week number.
    For example, today is Feb 3, 2015 (WEEK NUMBER 6), the parameter dropdown should only show
    Week 1
    Week 2
    Week 3
    Week 4
    Week 5
    Upon choosing a specific week, i.e. Week 2, SSRS report will show data where Created By matches the dates in Week 2 which is from January 4, 2015 to January 10, 2015 (SUNDAY is the first day week)
    ----------------------- Sharepoint Newbie

    Hi 120613,
    Because you are using the sharepoint list as the datasource and have some limitation when using query in the dataset, so I recommend you to take reference of the alternative method below which will not effect the filter of the data, you can create an calculated
    field which will use to create the week parameter, the values of the Week list are before the week number of the today's date and get based on the date field in the report.
    Details information below for your reference:
    Create an new dataset(DataSet2) to add the query which have the same structure as in the main dataset but only contain the field "Date".
    Right click the DataSet2 to select the "Add Calculated field" and create an new calculatted fields: name : "Week" and using expression below to get the value(The value will be the week number before the current date's week
    number):
    =IIF(DatePart("ww",Fields!date.Value)<DatePart("ww",Today()),DatePart("ww",Fields!date.Value),Nothing)
    Create the parameter week based on the Calculated field "Week", specify both the Available value and default value by "Get Values from a query"
    Add the filter in the Dataset as below:
    Expression:=DatePart("ww",Fields!Date.Value)
    Operator:In
    Value: [@Week]
    Preview you will got the result as below:
    If the parameter is Multiple and you got some duplicate values, please reference to the article
    Visakh16 have provided.
    If you still have any questions, please feel free to ask.
    Regards
    Vicky Liu
    If you have any feedback on our support, please click
    here.
    Vicky Liu
    TechNet Community Support

  • How to get date range of Current week

    Hi Gurus,
    I need to create report of current(this) week manual bills created by one user. I have date Field called CREAT_DATE.Based on this date column i need to create report.
    Could anybody help to get this query.
    Example:
    select .....
    from ....
    where
    CREAT_DATE
    Thank You
    Vikram

    It kind of depends on your definition of "current week". If you mean something like the last 7 days, then
    SELECT columns
    FROM table
    WHERE creat_date BETWEEN TRUNC(sysdate - 7) and TRUNC(sysdate +1)would do it.
    If you mean Monday until today, then:
    SELECT columns
    FROM table
    WHERE creat_date BETWEEN NEXT_DAY(TRUNC(sysdate - 7), 'MONDAY') and TRUNC(sysdate +1)Read up on the various date functions for other possibilities.
    TTFN
    John

  • Week Number of the current week...URGENT

    hi gurus,
    I want to calculate the week number of the current week as per Fiscal year.
    What variable or the Customer Exit code needs to be written for it?
    regards

    Hi Venu,
       Use the code below. I assume that the client is US based where the Fiscal Year starts 1st October every year.  Just in case the fiscal year starts in some other month then adjust the code (if SY-DATUM+4(2) >= 10.) below. Hope this helps.
    DATA: PFY(8)   TYPE C.
    DATA: CFY(4)   TYPE C.
    DATA: LFY      TYPE I.
    DATA: FYD      TYPE I.
    DATA: TWD      TYPE I.
    DATA: RES      TYPE I.
    if SY-DATUM+4(2) >= 10.
      concatenate SY-DATUM+0(6)
                  '01'
             into PFY.
    else.
      LFY = SY-DATUM+0(4).
      LFY = LFY - 1.
      CFY = LFY.
      concatenate CFY
                  SY-DATUM+4(2)
                  '01'
             into PFY. 
    endif.
    FYD = P_FY.
    TWD = SY-DATUM.
    RES = ( TWD - FYD ) / 7.
    Write: Res.

  • Number of current week

    How do I get the number of current week?

    select to_char(sysdate,'W') AS "WEEK OF THE YEAR" from dual (wk of the month)
    select to_char(sysdate,'WW') AS "WEEK OF THE YEAR" from dual (wk of the year)

  • Current date, first day of month, last day of month, current week, current

    Hi All,
    may be the question will sounds basic for your guys, I am connecting via MDX a cognos reportnet on a BW 3.0B..due to loads of limitations on filtering via MDX on 'business date/time functions' , I would need to create in the infoqueries that are my data sources, the following additionnal objects:
    - current date
    - first day of current month
    - last day of current month
    - current week
    - current year
    I do not want prefiltered infoqueiries but object with these single values so that from reportnet I can have something like: OCALDAY between 'first day of current month' and 'last day of curent month'
    Is there standard fonction for this under BW/BEX or if we need to developp functions has nayone some code examples.
    thanks a lot for your great input
    David

    Hi,
    In universe level if you want implement the requirede functions then you have to write custom sql and if you want to implement them in Reporting level then most of the functions are available to you. e.g. Quarter,Month, Year, Current Date....
    Cheers,
    Suresh A.

  • How to calculate start date and last date for current week

    Dear All.
    i want to calculate the start of the current week as well as the last date of the current week, our week start from Saturday and ends of Friday i.e. Saturday is the first day of the week and Friday is the last day of the week.
    How can i acheive this in universe Designer?.
    Please help...

    Hi
    the formulas in webi will be as follows
    for startdate
    =RelativeDate(LastDayOfWeek(CurrentDate());-8)
    for enddate:
    =RelativeDate(LastDayOfWeek(CurrentDate());-2)
    Regards,
    Ranganath

  • How to get the current week from sysdate?

    Hi sir,
    i want to know how to get the current week from sysdate?
    thanks

    Hi Nicolas
    It seems you like to check my post and also make commend ;) thanks for your attention
    Have you ever read the posts above and given solutions ?Yes, I did
    Have you read the docs ? Yes, I checked
    What's the added value here ?Did youYou shared doc with solution(long one), I shared short one which point same solution(Check what Joel posted)..So what is benefit, As you can guess oracle docs are sometimes become so complicated as specialy for beginner...(At least it was like that for me and Belive me somedocs are still sooo complicated even for oracle coworkers ) But for you I dont know ;)
    => Why writting the PS in bold ?Why.. Let me think... Ohh Maybe I am looking some questions(many) and even user get answer they should not changed status so I am reading some posts and try to get problem and loosing time..
    So I am putting that PS wiht BOLD because I dont wanna lose time my friend ;) Because While I am trying to help ppl here In same time I am trying to giving support to my customer prod systems. Which mean time is very important for me...
    Hope my answer could satisfy you..
    One important PS for you.. You may not like my posts (or someone) but my friend I become tired to read&answer and make commend to on your comment which is about my posts.
    I am not newbie in forum(At least I fell like that) and I belive I know how I should make post..
    Thank you
    Regards
    Helios

  • Urgent : Bill Qty based on Fisrt day of Previous week to current week

    Hi,
    I have to create a Restricted Key figure.
    Bill Qty is to be restricted on a day, which is first day of previous week.
    (1) I have restricted KF, with Current Week SAP exit variable.
    (2) Restricted KF, with Calendar Day (Variable ZDATE, customer exit type).
    (3) I have written Customer Exit in CMOD...
    data: LT_RANGE  type  RSR_S_RANGESID,
          LS_VAR_RANGE like RRRANGEEXIT.
    case i_vnam.
    when 'ZDATE'.
    if i_step = 2.
    break-point.
    loop at i_t_var_range into ls_var_range where vnam = '0CWEEK'.
    data: var1(2) type c,
          var2(4) type c,
          var3 LIKE SCAL-WEEK,
          date1 like scal-date,
          DATE2(10) TYPE C,
          MNTH(2) TYPE C,
          DAY(2) TYPE C,
          YEAR(4) TYPE C.
    var1 = ls_var_range-low(2).
    var2 = ls_var_range-low(4).
    concatenate var2 var1 into var3.
    CALL FUNCTION 'WEEK_GET_FIRST_DAY'
      EXPORTING
        WEEK               = var3
    IMPORTING
       DATE               = date1
    EXCEPTIONS
      WEEK_INVALID       = 1
      OTHERS             = 2
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    MNTH = DATE1+4(2).
    DAY = DATE1+6(2).
    YEAR = DATE1+0(4).
    CONCATENATE DAY '/' MNTH '/' YEAR INTO DATE2.
    lt_range-low = date2.
    lt_range-high = date2.
    lt_range-sign = 'I'.
    lt_range-opt = 'eq'.
    append lt_range to e_t_range.
    endloop.
    endif.
    <b>BUT I AM GETTING ERROR -</b>
    00010004              AError for variable in customer enhancement ZDATE
    Please suggest any idea..
    Thanks
    saurabh

    Hi Saurabh,
    Please try this dample code
    WHEN 'ZDATE'.
    DATA: Z_WEEK TYPE SCAL-WEEK.
    *Determine current week from SY-DATUM
            CALL FUNCTION 'DATE_GET_WEEK'
              EXPORTING
                DATE               = SY-DATUM
              IMPORTING
                WEEK               = Z_WEEK.
    *Determine first day of current week 
            CALL FUNCTION 'WEEK_GET_FIRST_DAY'
              EXPORTING
                WEEK = Z_WEEK
              IMPORTING
                DATE = LT_RANGE-LOW.
    LT_RANGE-SIGN = 'I'.
    LT_RANGE-OPT = 'eq'.
    APPEND LT_RANGE TO E_T_RANGE.
    Regards
    Joe

  • Get the Current Quarter  and Current Week from date

    Hi,
    I want to get the Current quarter and Current week from a given date, which function modules should i use?
    I tried using function module - 'HR_99S_GET_QUARTER' for getting the quarter but it is throwing an error while loading data. Moreover it doesnt exist in BI7.
    Similarly for current week.
    Please help. Sample code snippets would be appreciated.
    Thanks
    Jaya

    You can use FORM time_conversion wich is the one used by standard in Update Rules:
    You can select whether convert 0CALDAY to 0CALWEEK or whatever infobject formats you prefer...
      perform time_conversion
                using  '0CALDAY'
                       '0CALMONTH'
                        p_input_date
                        l_fscvtval
                changing RESULT
                         c_t_idocstate
                         c_subrc
                         c_abort.
      if c_subrc <> 0 or c_abort <> 0.
        exit.
      endif.
    form time_conversion
                   using i_timnm_from type rsiobjnm
                         i_timnm_to   type rsiobjnm
                         i_timvl
                         i_fiscvarnt  type t009b-periv
                   changing e_timvl
                            c_t_idocstate  type rsarr_t_idocstate
                            c_subrc   like sy-subrc
                            c_abort   like sy-subrc. "#EC *
    data: l_timvl  type rsd_chavl,
          l_result type rsd_chavl.
      IF i_timvl CO ' 0'.
        CLEAR e_timvl.
        EXIT.
      ENDIF.
      l_timvl = i_timvl.
      CALL FUNCTION 'RST_TOBJ_TO_DERIVED_TOBJ'
        EXPORTING
          i_timnm_from             = i_timnm_from
          i_timnm_to               = i_timnm_to
          i_timvl                  = l_timvl
          I_FISCVARNT              = i_fiscvarnt
          I_BUFFER                 = rs_c_true
        IMPORTING
          E_TIMVL                  = l_result
        EXCEPTIONS
          INCOMPATIBLE_TOBJS       = 1
          NO_INPUT_VALUE           = 2
          FISCVARNT_MISSING        = 3
          INPUT_NOT_NUMERIC        = 4
          WRONG_DATE               = 5
          WRONG_FISCPER            = 6
          X_MESSAGE                = 7
          OTHERS                   = 8
      e_timvl = l_result.
    ENDFORM.                  "TIME_CONVERSION

  • Get current week of calendar

    Hi there,
    I want do get the number of the current week into a integer.
    my code:
    <%@ page import="java.sql.*" %>
    <%@ page import="java.io.*" %>
    <%@ page import="java.util.*"%>
    Calendar calendar = Calendar.getInstance();
    int kw = calendar.WEEK_OF_YEAR;
    session.setAttribute( "show_kw", kw);
    session.setAttribute( "kw", kw); // please do not wonder...I need this, tooLater in my code I want to display this number:
    <p><%
              session.getAttribute("show_kw");
              %></p>But it displays...nothing. Not even a space.
    Any idea, why it isn't showing up the number?
    X--spYro--X

    You need to use the following :
    int kw = calendar.get(Calendar.WEEK_OF_YEAR);instead of
    int kw = calendar.WEEK_OF_YEAR;in your code.
    Hope this helps.
    Thanks

  • Filter the current week in Outlook Calendar with SQL DASL

    Hello!
    I'm trying to make a new view in Outlook Calendar that displays meetings with a specific subject. The problem is that I can't find anywhere how to show the meetings for the current week only.
    My SQL DASL syntax is so far:
    "http://schemas.microsoft.com/mapi/proptag/0x0037001f" LIKE '%21%'
    And the result is:
    I have tried to use the %thisweek% parameter without result as I don't know how this should be used (look here to see what I mean
    http://blogs.msdn.com/b/andrewdelin/archive/2005/05/11/416312.aspx?Redirected=true).
    Thanks in advance!

    Hi,
    I think it should be an Outlook related question. Please post a new one on Outlook forum via:
    http://social.technet.microsoft.com/Forums/office/en-US/home?forum=outlook
    Thanks,
    Simon Wu
    TechNet Community Support

  • Current week?

    Hello Experts,
    I have a day name column and 3 measures query count, row count... and the requirement i have is, i need to get the data about the current week it means when i run the report now i should get only Monday of this week and its row count, query count.. and when i run it tomorrow i should get Monday, Tuesday and when i run it on wednesday Monday, tuesday, Wednesday and so on. Please let me know if i am not clear with my presentation. I am wondering how i can achieve this.
    Thanks,
    RC

    Thanks for your response. I tried your code in the date column filter but its not working, i am getting error not sure if i can just take it and use the same code in the filter criteria. To be more clear i have Day name(Monday, Tuesday..), Day number(for sunday its 1,Monday 2,tuesday 3..) and Date (in the format 11/6/2011...) and the rest are measures,. Basically this is a system generated report like stats report. My requirement is i need to get the current week data as i mentioned earlier if i run the report today it should give me the information only from sunday to today. Please let me know how i can achieve this.
    Thanks,
    RC
    Edited by: user1146711 on Nov 8, 2011 8:55 AM

Maybe you are looking for

  • App Store has badge showing 8 Updates available but when I open the App Store, there are none showing under the Updates tab

    My App Store Icon has a Badge showing that there are 8 Updates available.  When I open up the App Store and go to Updates, the screen is blank.  This is the first time I've experienced this and I don't find any other discussions in the Apple Communit

  • Can't close Firefox after eradicating Fake.Trojan virus

    Got infected with Fake.Trojan virus today while surfing email via Firefox. Successfully used Malwarebytes to clean up the mess but some carnage remains. On a WIn7 platform. During infection and since eradication I keep getting this message, "Firefox

  • ALV LAYOUT Related question

    I am developing an ALV report where I have 3 (basic, secondary 1 and secondary 2)lists. Here can I use only one LAYOUT for all the 3 lists or I have to maintain 3 layout declarations for 3 lists. Give me one example. Thanks for your precious time. Re

  • How is PRICAT being used in ECC6.0

    Hi, Can someone explained to me how is the PRICAT being used in ECC6.0 and what're the advantages? Thanks bye

  • PhotoStream and AppleID???

    Hello, I am interested in buying the current AppleTV, but there are a couple of things I need to know that a web search doesn't tell me. Does AppleTV automatically sign out of PhotoStream after a certain period or will it stay logged in all the time?