|
-
Feb 1st, 2006, 10:52 PM
#1
Thread Starter
Fanatic Member
Date and time
Is there a function to compare date with time, i have month(),year().etc what about a specific date? like xx()<=02/2/2006
-
Feb 1st, 2006, 11:14 PM
#2
Re: Compare year together with month
You can use DateDiff to compare Dates, or Dateadd to add hours, days, months..etc
DateDiff Example: Find the diff in days between 2 dates..
Code:
Dim Ld As Date
Ld = #12/8/2005#
MsgBox DateDiff("d", Ld, Date) ' "d" = Days
-
Feb 1st, 2006, 11:27 PM
#3
Thread Starter
Fanatic Member
Re: Compare year together with month
but if i want to compare specific month WITH year i put d (as day) is ok?
-
Feb 1st, 2006, 11:33 PM
#4
Re: Date and time
Would you elaborate? Compare date with time?
-
Feb 1st, 2006, 11:38 PM
#5
Re: Compare year together with month
 Originally Posted by Goh
but if i want to compare specific month WITH year i put d (as day) is ok?
I don't understand , write some code so I can see what you're trying to do.
Last edited by jcis; Feb 1st, 2006 at 11:43 PM.
-
Feb 1st, 2006, 11:45 PM
#6
Re: Compare year together with month
You can use.. Day(Date), for days.
Also, Format(Date, "mmyy") will show you month and year (without days)
-
Feb 1st, 2006, 11:45 PM
#7
Re: Date and time
There are several date/time functions.
DateDiff
DateAdd
Hour
Minute
Second
'...
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Feb 1st, 2006, 11:48 PM
#8
Re: Compare year together with month
Threads merged.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Feb 2nd, 2006, 12:41 AM
#9
Thread Starter
Fanatic Member
Re: Compare year together with month
sorry guys ...actually i only wanted to compare a certain date...as in only the
like any date that is greater or equals than 01/01/2005 ..something like that
-
Feb 2nd, 2006, 01:18 AM
#10
Thread Starter
Fanatic Member
Re: Compare year together with month
by the way am using sql statement ... passing query in vb..
dim DateRef as date
DateRef="01/01/2005"
.
.
sql = sql & "and DateDiff("d", DateFromRecordset, DateRefer)<0 ..."
but how am i going to amend the code 'd' ?is the above correct?
Last edited by Goh; Feb 2nd, 2006 at 01:24 AM.
-
Feb 2nd, 2006, 01:23 AM
#11
Re: Compare year together with month
then you can use the datediff functions, but why dont you post the code here, so that, we can help you properly without wasting too many posts
If an answer to your question has been helpful, then please, Rate it!
Have done Projects in Access and Member management systems using BioMetric devices, Smart cards and BarCodes.
-
Feb 2nd, 2006, 01:34 AM
#12
Thread Starter
Fanatic Member
Re: Compare year together with month
i want to retrieve records which dated 01/02/2005 and later.. ...the database uses smalldatetime like 16/12/1999 6:21:00 PM..
i think should use "y" ya? cause i only want month and year after the one above..
The actual problem is that if i use Year() and month() separately, things will not go right.
Last edited by Goh; Feb 2nd, 2006 at 02:04 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|