473,395 Members | 1,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

NOW() gives you a current date/time stamp

Is there a function that stamps the FISCAL Date (Starting from
October)?

I am trying to generate a Fiscal Date and an AutoNumber for a key
field.

Thanks for any suggestions.

RBollinger

Oct 31 '06 #1
2 5992
"rpboll" <RP****@gmail.comwrote in
news:11**********************@k70g2000cwa.googlegr oups.com:
Is there a function that stamps the FISCAL Date (Starting from
October)?

I am trying to generate a Fiscal Date and an AutoNumber for a key
field.
What kind of number would you want? Do you want October dates to be
recorded as January? Or a day number from September 30th?

Date() returns the current date. You should probably write a
user-defined function to handle the calculation.

To return the Year part of the fiscal year, you'd do this:

Function FiscalYear(dteDate As Date) As Integer
Dim intMonth As Integer

intMonth = Month(dteDate)
If intMonth < 10 Then
FiscalYear = Year(dteDate) - 1
Else
FiscalYear = Year(dteDate)
End If
End Function

If you want to return the beginning of the fiscal year for a
particular date, you'd alter that to this:

Function FiscalYearStart(dteDate As Date) As Date
Dim intMonth As Integer
Dim intYear As Integer

intMonth = Month(dteDate)
If intMonth < 10 Then
intYear = Year(dteDate) - 1
Else
intYear = Year(dteDate)
End If
FiscalYearStart = DateSerial(intYear, 10, 1)
End Function

Another approach to getting the year would be:

Year(DateAdd("m", -9, Date()))

and then you could use:

Format("10/1" & Year(DateAdd("m", -9, Date())), "m/d/yyyy")

and that would give it to you.

Now, what you want in your fiscal date field, I don't know. If you
want the number of days since the beginning of the fiscal year,
you'd use the function above like this:

Date() - FiscalYearStart(Date())

That will give you the number of days since the begining of the
fiscal year. If you want the ordinal number, you'd add 1, since the
expression above gives zero for the first day of the fiscal year (as
to be expected).

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Oct 31 '06 #2
Thank you for your detailed answer.
David W. Fenton wrote:
"rpboll" <RP****@gmail.comwrote in
news:11**********************@k70g2000cwa.googlegr oups.com:
Is there a function that stamps the FISCAL Date (Starting from
October)?

I am trying to generate a Fiscal Date and an AutoNumber for a key
field.

What kind of number would you want? Do you want October dates to be
recorded as January? Or a day number from September 30th?

Date() returns the current date. You should probably write a
user-defined function to handle the calculation.

To return the Year part of the fiscal year, you'd do this:

Function FiscalYear(dteDate As Date) As Integer
Dim intMonth As Integer

intMonth = Month(dteDate)
If intMonth < 10 Then
FiscalYear = Year(dteDate) - 1
Else
FiscalYear = Year(dteDate)
End If
End Function

If you want to return the beginning of the fiscal year for a
particular date, you'd alter that to this:

Function FiscalYearStart(dteDate As Date) As Date
Dim intMonth As Integer
Dim intYear As Integer

intMonth = Month(dteDate)
If intMonth < 10 Then
intYear = Year(dteDate) - 1
Else
intYear = Year(dteDate)
End If
FiscalYearStart = DateSerial(intYear, 10, 1)
End Function

Another approach to getting the year would be:

Year(DateAdd("m", -9, Date()))

and then you could use:

Format("10/1" & Year(DateAdd("m", -9, Date())), "m/d/yyyy")

and that would give it to you.

Now, what you want in your fiscal date field, I don't know. If you
want the number of days since the beginning of the fiscal year,
you'd use the function above like this:

Date() - FiscalYearStart(Date())

That will give you the number of days since the begining of the
fiscal year. If you want the ordinal number, you'd add 1, since the
expression above gives zero for the first day of the fiscal year (as
to be expected).

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
Nov 1 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Don | last post by:
Hi all, With regards to the following, how do I append the datetimestamp to the filenames in the form? The files are processed using the PHP script that follows below. Thanks in advance,...
5
by: middletree | last post by:
Is there a script that will populate, with a click, a textbox with the equivalent of the ASP/VBScript Now() function? In ohter words, I'd like it to be in this format: 7/25/2005 10:58:39 AM
24
by: Bob Wickham | last post by:
Hi, I have some sql in a sub that finds dates in a table but only if the date is less than today WHERE < Now() I want it to do that but to not include the current month. For instance, a...
6
by: Mike Charney | last post by:
Is there a way to check a files date and time stamp from VBA in access. I have a need check a date stamp on a file that I am importing. Thanks in advance, Mike m charney at dunlap hospital...
5
by: Des | last post by:
I have to do an events calender for a church. The events display will be limited to that week. If someone went in today Wed 24th I want to display 21st to 27th. I dont want any code samples, just...
3
by: phried1 | last post by:
I have created a form and inserted the following tables: Date Entered Time Entered Date Modified Time Modified Essentially how and where can I have these dates and times recorded so when the...
6
by: trytobreak | last post by:
Hi All, I am a network administrator in a fairly large software company and I would like to write myself a small utility, which would connect (one by one) to all machines on the network and get...
16
by: W. eWatson | last post by:
Are there some date and time comparison functions that would compare, say, Is 10/05/05 later than 09/22/02? (or 02/09/22 format, yy/mm/dd) Is 02/11/07 the same as 02/11/07? Is 14:05:18 after...
29
by: WannabePrgmr | last post by:
I am trying to display total numbers of data in a textbox, "Textbox200" on a form "Master", but I only want to display current daily data. I currently get the data from: Me.Text200 = DCount("",...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.