Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > birthday


Reply
 
Thread Tools Display Modes
  #1  
Old 12-22-2003, 12:06 PM
the master's Avatar
the master the master is offline
Tachikoma
 
Join Date: Mar 2003
Location: Mansfield, UK
Posts: 4,594
Default birthday


hi, how can i tell if its someones birthday?

i have the date of birth 00/00/0000, and i have todays date, i want to know if they match. i could use the left() function to see if the day and month match but.... i have a time shift thing on it for timezones. i have a sub that will need to take the time and add or take the correct amount of hours, then if it goes to another day, it needs to adjust the date.

any ideas how i can do the timeshift AND the birthday subs?

i know i can use the datediff() function but im not quite sure how to go about it, i need the timeshift result to be in the same format as the now function
__________________
"That which seems simple is often overlooked" ~ me
Halloween Special FX
Web Hosting from Spook Technologies
Reply With Quote
  #2  
Old 12-22-2003, 12:09 PM
tHuNd3r's Avatar
tHuNd3r tHuNd3r is offline
Junior Contributor
 
Join Date: Jul 2003
Location: Brazil
Posts: 213
Default

ok, just make something like this:

Code:
If Cdate(now) = cdate("01/01/2003) then 'yes its today End If
__________________
tHuNd3rSp0t

Believe
Dreaming is the first step for any conquest
Reply With Quote
  #3  
Old 12-22-2003, 12:19 PM
00100b's Avatar
00100b 00100b is offline
Martian In Disguise

Retired Moderator
* Guru *
 
Join Date: May 2003
Location: Minneapolis, MN
Posts: 9,566
Default

You could use the DatePart function to compare the Day and Month of both the BirthDate and the current Date or you could use the Day and Month functions to a similar comparison.
Code:
' Assumes dteBirth is a variable containing the date of birth. If Month(dteBirth) = Month(Date) And Day(dteBirth) = Day(Date) Then MsgBox "Today is your birthday!" End If
__________________
The only stupid question is the one that goes un-asked.
Reply With Quote
  #4  
Old 12-22-2003, 12:28 PM
the master's Avatar
the master the master is offline
Tachikoma
 
Join Date: Mar 2003
Location: Mansfield, UK
Posts: 4,594
Default

ok, that looks like its gonna work fine now, thanx.

now what about the dateshift part? the timezone will be stored as hour and minute difference. 00:00. how do i make a function that can take care of that

private function DateShift(nDate as date) as date

i need it to convert the whole date and time, not just the time, if its 11:00 pm and someone is in a +3:00 timezone then it will show as 14:00 am. how do i sort that out?
__________________
"That which seems simple is often overlooked" ~ me
Halloween Special FX
Web Hosting from Spook Technologies
Reply With Quote
  #5  
Old 12-22-2003, 12:31 PM
00100b's Avatar
00100b 00100b is offline
Martian In Disguise

Retired Moderator
* Guru *
 
Join Date: May 2003
Location: Minneapolis, MN
Posts: 9,566
Default

You can use the DateAdd function to add/subtract hours from a given date.
__________________
The only stupid question is the one that goes un-asked.
Reply With Quote
  #6  
Old 12-22-2003, 12:39 PM
the master's Avatar
the master the master is offline
Tachikoma
 
Join Date: Mar 2003
Location: Mansfield, UK
Posts: 4,594
Default

hmm, simple. lol.

vb seems to have a function for everything
__________________
"That which seems simple is often overlooked" ~ me
Halloween Special FX
Web Hosting from Spook Technologies
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Happy Birthday Lebb Robby Tech Discussions 38 07-26-2002 12:06 AM
Happy Birthday Bob Derek Stone Tech Discussions 16 04-01-2002 11:28 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->