-3

how to get financial year in asp.net web form in Textbox automatically. i have a textbox in asp.net how to show financial year automatically. 2 exp; 2019-2020 (1 april to 31 march)

lksharma
  • 1
  • 2
  • do you want to have full date ie 1 april 2019 to 31 march 2020. – Shusil Satyal Jan 06 '20 at 07:56
  • No. i need like :2019-2020 . if month is april 2019 it shows 2019-2020. and if month march 2020 it shows 2019-2020. – lksharma Jan 06 '20 at 09:19
  • how to show from date and to date in two different text box using date picker in asp.net web form using j query – lksharma Jan 06 '20 at 10:20
  • Have you received my answer below ? – Shusil Satyal Jan 06 '20 at 10:23
  • yes i received tnks – lksharma Jan 06 '20 at 10:59
  • i have to select one officer name out of shown three officer name in drop down on select of one programme name in this page. but officer name is generated on other page and inserted in to database on the basis of programme name. Now generated officer name is shown in dropdown list after selection of programme name .if one officer name is selected then other means second officer name is select in second dropdown list and programme name is same. how to bind the dropdown list asp .net web form in c# . asp.net – lksharma Jan 07 '20 at 04:59

3 Answers3

2

Then here is your answer,

DateTime dateTime = DateTime.Now;
 string fiscalyear;
 if (dateTime.Month >= 4)
 {
   fiscalyear =  dateTime.Year + " - " + (dateTime.Year + 1);
 }
 else
 { 
   fiscalyear = (dateTime.Year - 1) + " - " + dateTime.Year;
 }
 textbox1.Text = fiscalyear;
Shusil Satyal
  • 380
  • 1
  • 6
  • how to show from date and to date in textbox using datepicker in asp.net web form using jquery – lksharma Jan 06 '20 at 10:13
  • using Java script ? – Shusil Satyal Jan 06 '20 at 10:53
  • please reply using any method in asp.net web form – lksharma Jan 06 '20 at 11:01
  • Reference : https://stackoverflow.com/questions/1469280/asp-net-datetime-picker – Shusil Satyal Jan 06 '20 at 11:06
  • i have to select one officer name out of shown three officer name in drop down on select of one programme name in this page. but officer name is generated on other page and inserted in to database on the basis of programme name. Now generated officer name is shown in dropdown list after selection of programme name .if one officer name is selected then other means second officer name is select in second dropdown list and programme name is same. how to bind the dropdown list asp .net web form in c# . asp.net – lksharma Jan 07 '20 at 04:58
0

i found the solution which help me:

textbox1.Text = DateTime.Now.Year.ToString();
RobC
  • 22,977
  • 20
  • 73
  • 80
  • No. i need like :2019-2020 financial year . if month is april 2019 it shows 2019-2020. and if month march 2020 it shows 2019-2020 autimatically fill in textbox. – lksharma Jan 06 '20 at 09:24
0

use this query

DECLARE @FIYear VARCHAR(20)

SELECT @FIYear = (CASE WHEN (MONTH(GETDATE())) <= 3 THEN convert(varchar(4), YEAR(GETDATE())-1) + '-' + convert(varchar(4), YEAR(GETDATE())%100)
ELSE convert(varchar(4),YEAR(GETDATE()))+ '-' + convert(varchar(4),(YEAR(GETDATE())%100)+1)END)

SELECT @FIYear AS F_YEAR