473,407 Members | 2,326 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,407 software developers and data experts.

Converting a date into the month

3
Hello everyone,

This is the first time I am posting here, and hope I can explain what I want to do.

I have an expiration date and I want to compare to the current month. If they agree, then I want to put a warning that the expiration date is coming up. I've learned about Month(Now()) and DatePart(mm,x). Don't know if I need these to get the answer I want.

Thanks for the help!
Cliff
Sep 13 '06 #1
5 2333
sanniep
48
Hello everyone,

This is the first time I am posting here, and hope I can explain what I want to do.

I have an expiration date and I want to compare to the current month. If they agree, then I want to put a warning that the expiration date is coming up. I've learned about Month(Now()) and DatePart(mm,x). Don't know if I need these to get the answer I want.

Thanks for the help!
Cliff
Try the following expression: iif(Datepart("m";Now();2;2)=Datepart("m";[Expiration Date];2;2);"Experation date is coming up!";"")

The datepart expression formats the current systemdate and your (date/time formatted) Experation Date field to monthnumbers. The variables 2;2 represent the format of the year and first week of the year. Take a look at the datepart-help to read about this variables

The iif matches systemdate and experation date, if they match the field will display "Experation date is coming up", field stays empty when they don't match.

Grtz, Sander
Sep 13 '06 #2
cliffk
3
Hi

Thanks for the quick response. Excuse my ignorance, but what does the 2;2 do in the formula?

Thanks again
Cliff
Sep 13 '06 #3
sanniep
48
Hi

Thanks for the quick response. Excuse my ignorance, but what does the 2;2 do in the formula?

Thanks again
Cliff
That's to let the expression know what you want defined as the first day of the week and how your year starts:

First 2: monday is the first day of the week (over here in Holland it is)
Second 2: week 1 is the week which contains at least 4 days of the new year

Look into the Access-Help and check the datepart-function variables to see the options!

Regards, Sander
Sep 13 '06 #4
PEB
1,418 Expert 1GB
Hi,
those are the first day of the week and the first day of the year!

See them!

The firstdayofweek argument has these settings:

Constant Value Description
vbUseSystem 0 Use the NLS API setting.
vbSunday 1 Sunday (default)
vbMonday 2 Monday
vbTuesday 3 Tuesday
vbWednesday 4 Wednesday
vbThursday 5 Thursday
vbFriday 6 Friday
vbSaturday 7 Saturday



The firstweekofyear argument has these settings:

Constant Value Description
vbUseSystem 0 Use the NLS API setting.
vbFirstJan1 1 Start with week in which January 1 occurs (default).
vbFirstFourDays 2 Start with the first week that has at least four days in the new year.
vbFirstFullWeek 3 Start with first full week of the year.
Sep 13 '06 #5
cliffk
3
Thank you for all the help! Loving this discussion group!

Cliff
Sep 13 '06 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and...
6
by: Jim Davis | last post by:
Before I reinvent the wheel I thought I'd ask: anybody got a code snippet that will convert the common ISO8601 date formats to a JS date? By "common" I mean at the least ones described in this...
3
by: sunny076 | last post by:
Hi, I am trying to convert from Julian to Gregorian data in C#. I was exploring teh JulianCalendar and Gregorian calendar classes but still not sure how I can do it. For example, the Julian date...
12
by: Assimalyst | last post by:
Hi, I have a working script that converts a dd/mm/yyyy text box date entry to yyyy/mm/dd and compares it to the current date, giving an error through an asp.net custom validator, it is as...
1
by: lisa.moffitt | last post by:
How can I create a field in a view that takes a date field and converts it to a month? For instance, if I have a field called "CreatedOn" with a date of '2/22/2007', how can I create another field...
16
by: nsymiakakis | last post by:
Hi All, First let me start by saying, I absolutely love this site. I have an access database that records are keyed in including a date field. i.e. 3/4/07, 3/20/07, 4/10/07,4/18/07, 5/4/07... and...
2
by: Brian Parker | last post by:
I am beginning to work with VB2005.NET and I'm getting some problems with string formatting converting an application from VB6. VB6 code:- sTradeDate = Format(pArray(4,i Record), "mmddyy") ...
3
by: Jef Driesen | last post by:
How can I convert a date string to a number (e.g. a time_t value or a tm struct)? I know about the strptime function, but then I have to know the format string. And that is a problem. I'm trying...
1
by: jrhitokiri | last post by:
I'm working on a wicket project, and I'm kinda stumped here on trying to get the components of the date. Thing is, I don't want to use deprecated code, so I decided on using Calendar instead. For...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.