Reputation:
I want to write in an Access report "final examination 2019-20" in that format.
This should be the four digit current year, followed by a two digit following year : yyyy-yy
. Is there a way to Format
the current Date()
to solve this?
Upvotes: 1
Views: 2170
Reputation: 55816
Or, for the fun, use Format once only:
=Format(Year(Date())*100+(Year(Date())+1) Mod 100,"0000-00")
Session is starting from every year April to March. Report need to publish in twice in that year first report on October and another on March. In Both condition Year will be 2019-20. After March Year will change 2020-21 automatically.
That needs an adjustment to the fiscal year, which can be done like this:
=Format(Year(DateAdd("m",9,Date()))*100+(Year(DateAdd("m",9,Date()))+1) Mod 100,"0000-00")
Upvotes: 1
Reputation: 16015
Alternatively, you can use Format
for both parts:
Format(Date(),"yyyy-") & Format(DateAdd("yyyy",1,Date()),"yy")
Upvotes: 1
Reputation: 3455
Try this, it should be what you need:
Format(Date(),"yyyy-") & Right(Year(Date())+1,2)
Note that when you don't use that expression in the VBE in a code window, but in a property field, commas must be replaced by semicolons.
Upvotes: 1
Reputation: 25252
This cannot be a Format
but can be an Expression
:
Year(myDate) & "-" & right(Year(myDate)+1,2)
Upvotes: 1