Atlanta Custom Software Development 

   Search        Code/Page

User Login



Forgot the Password?
» Web Development
» Maintenance
» Data Integration/BI
» Information Management
VB VB (1647) (736)
C# C# (15) (779)
ASP ASP (41)
VC++ VC++ (25)
JScript JScript (5)
» SQL Server (708)
» ORACLE (5)
» MySQL (0)
» DB2 (0)
» C/C++/ASM (11)
» Microcontroller (1)
» Circuit Design (0)
» Networking (5)
» Unix/Linux (1)
» WinNT/2k/2003 (8)
» Flash (0)
» Maya (0)
» 3D max (0)
» Photoshop (0)
» (2)
» PC Interfacing (1)
» Networking (4)
» SQL Server (4)
» VB (23)
» (4)
» VC (3)
» HTML/CSS/JavaScript (10)
» Regular Expr Tester
» Free Tools

(Page 1 of 2) 31 Result(s) found 

An enhanced VB DatePart function
Total Hit (1176) Here is an enhanced version of VB DatePart function: the first parameter is now an enumerated type, so easier to use. DatePartEx is 4-5 times faster than DatePart and supports also two new intervals: MonthName and WeekdayName.
Benchmarks with millisecond accuracy
Total Hit (1002) The Timer function returns a value which is only accurate to about 55 milliseconds, therefore it is not very useful for doing accurate benchmarks. If you need a better resolution you may try out this function:
Beware of slashes when formatting dates
Total Hit (658) You probably use the Format function to format date, for example: «Code LangId=1» ? Format(Now, "mm/dd/yyyy") ' => 08/01/2001 ? Format(Now, "mm+dd+yyyy") ' => 08+01+2001 «/Code» It seems that this is everything you need to know, right? However, the story is quite different ....Read More
Create a system timer using AddressOf and a callback function
Total Hit (1045) The Timer control is great when you want to periodically execute a piece of code while the program is doing something else. However, it also has a couple of shortcomings: (1) it requires a parent form, so you can't use it directly inside a BAS module, and (2) it's Interval property can't be higher t ....Read More
Evaluate the number of days remaining in the current year
Total Hit (620) The DatePart() function can return the number of days from the beginning of the current year, but there is no VB built-in function that returns the number of days left to the end of the year. You can work around this with the DateDiff function: «Code LangId=1» ' aDate contains a valid date Days ....Read More
High-precision timing with the QueryPerformanceCounter API function
Total Hit (1079) While VB Timer functions is sufficiently precise for most tasks, it doesn't provide the highest possible resolution most modern computer can provide. If your hardware supports high-resolution counters, you can do a much better job with a pair of API functions: «Code LangId=1» Private Type LARGE_ ....Read More
Retrieve Time Zone information
Total Hit (3417) The GetTimeZoneInformation API returns a TIME_ZONE_INFORMATION variable that contains several pieces of information about system's time date and time setting. The first Long value in this structure holds the "distance" (in minutes) from Greenwich standard time, so it's quite easy to create a GetTime ....Read More
Test for Leap Year
Total Hit (783) As long as you trust VB's IsDate function (and you can, trust me), here's the shorted and fastest method to check if a year is a leap year or not: «Code LangId=1» Function IsLeapYear(year As Integer) As Boolean IsLeapYear = IsDate("2/29/" & CStr(year)) End Function «/Code» Here's is anot ....Read More
The age of a person
Total Hit (628) You can quickly evaluate the age of a person using the following function: «Code LangId=1» Function Age(BirthDate As Date, Optional CurrentDate As Variant) As Integer If IsMissing(CurrentDate) Then CurrentDate = Now Age = Year(CurrentDate) - Year(BirthDate) End Property «/Code» If ....Read More
The beginning or end of previous week
Total Hit (864) For reporting, many times you need to figure out what date last week began and ended. Use the code below to figure that out:
The number of days in a month
Total Hit (821) You need just one-line function to evaluate the number of days in a month (while taking leap years into account, of course). The trick is to use the DateDiff and DateSerial functions to calculate the difference between the first day of the current month and the first day of the subsequent month : ....Read More
Tricks with DateSerial
Total Hit (688) The DateSerial function has an interesting feature: it doesn't raise errors when you pass it an invalid month or day number. Instead, it evaluates the date as if the arguments were valid. For example, DateSerial(2000, 1, 32) returns the Date value of February 1, 2000. This behavior can (and should) ....Read More
Use Sleep API to add pauses to your programs
Total Hit (968) Don't use an empty For...Next loop to add pauses to your programs; instead, use the Sleep API function, that releases the CPU and lets other apps in the system effectively multitask: «Code LangId=1» Declare Sub Sleep Lib "kernel32" (ByVal milliseconds As Long) ' pause for 5 seconds Sleep 5000 ....Read More
BusinessDateAdd - Add or subtract a number of business days from a date
Total Hit (520) «Code LangId=1» ' add or subtract a number of business days from a date ' ' Note that it doesn't take Christmas, Easter and ' other holidays into account Function BusinessDateAdd(ByVal days As Long, ByVal StartDate As Date, _ Optional ByVal SaturdayIsHoliday As Boolean = True) As Date ....Read More
BusinessDateDiff - Evaluate the number of business days between two dates
Total Hit (706) «Code LangId=1» ' Evaluate the number of business days between two dates ' ' Note that it doesn't take Christmas, Easter and ' other holidays into account Function BusinessDateDiff(ByVal StartDate As Date, ByVal EndDate As Date, _ Optional ByVal SaturdayIsHoliday As Boolean = True) As L ....Read More
EasterDate - Evaluate the date of Easter for a given year
Total Hit (631) «Code LangId=1» ' Evaluate the Easter date for a given year Function EasterDate(ByVal Year As Integer) As Date Dim G As Integer Dim C As Integer Dim H As Integer Dim i As Integer Dim j As Integer Dim L As Integer Dim Month As Integer Dim Day As Integer ....Read More
FormatDateTimeEx - Extended formatting for date and time values
Total Hit (766) «Code LangId=1» Enum DateTimeFormat dtGeneralDate dtLongDate dtMediumDate dtShortDate dtLongTime dtMediumTime dtShortTime dtCustom End Enum ' Enhanced VB FormatDateTime function Function FormatDateTimeEx(newDate, Optional ByVal dtFormat As ....Read More
FormatInternationalDate - Retrieving a date in an international format
Total Hit (1043) «Code LangId=1»' *** International date handler Public Enum eDateLocale edlArabic = &H401 edlDanish = &H406 edlGerman = &H407 edlSwissGerman = &H807 edlAmerican = &H409 edlBritish = &H809 edlAustralian = &HC09 edlSpanish = &H40A edlFinnish = &H40B edlFrench ....Read More
GetDBDate - Formatting a date as a DateSerial for Access
Total Hit (601) «Code LangId=1»' Format a date as a DateSerial for Access ' Example: Debug.Print GetDBDate(date) Public Function GetDBDate(sDate As String) As String On Error GoTo ERROR_GetDBDate Dim sTmp As String If IsDate(sDate) = False Then sTmp = sDate Else sTmp = "DateSe ....Read More
GetRoshHashanah - Get the date of Rosh Hashanah (Jewish calendar)
Total Hit (556) «Code LangId=1»' Returns the date that Rosh Hashanah begins ' for the requested year. It is important to note that ' Rosh Hashanah is based on the Lunar cycle so the Holiday ' actually begins at sunset of the day before the date ' returned by this function. ' Note: Many dates in the Jewish ....Read More
IsValidDateField - Check whether a date is valid
Total Hit (665) «Code LangId=1»Enum psDateTypes AnyValidDate 'Allows any valid date to be entered PastDate 'Only allows past dates (before today) to be entered FutureDate 'Only allows future dates (after today) to be entered TodayOrFuture 'Only allows today or future date to be ....Read More
Monday - retrieving the date of the Monday for a specified week
Total Hit (553) «Code LangId=1» ' Return the date of the Monday for a specified week.. ' This function can be tweaked to return any weekday. I use it in Access to ' subdivide reports into weekly units, since Access displays only a number ' between 1 and 53 for the week when you group dates by week. ' ' Note ....Read More
PerformanceTimer - A class module for high-resolution time measurement
Total Hit (993) «Code LangId=1» '------------------------------------------- ' PerformanceTimer class module '------------------------------------------- ' Use this class to profile your code and any other operation ' typically with a precision greater than 1 millionth of a second ' ' As soon as you creat ....Read More
SecondsToString - Convert a number of seconds into a formatted time string
Total Hit (539) «Code LangId=1» ' Converts a numeric value in seconds to a string ' Example: ' MsgBox SecondsToString(3920) --> 1h.5m.20s Function SecondsToString(ByVal Seconds As Long) As String SecondsToString = (Seconds \ 3600) & "h." & ((Seconds \ 60) Mod 60) & "m." _ & (Seconds Mod ....Read More
SecondsToTime - Convert a number of seconds to a Date value
Total Hit (670) «Code LangId=1»' Converts a numeric value in seconds to a time value ' Example: ' MsgBox SecondsToTime(11120) --> 3.5.20 AM Function SecondsToTime(ByVal Seconds As Long) As Date SecondsToTime = CDate(Seconds / 86400) End Function «/Code» ....Read More
TimeToMinutes - Convert a time value into a number of minutes
Total Hit (535) «Code LangId=1»' Converts a time value to a numeric value in minutes ' Example: ' MsgBox TimeToMinutes(TimeSerial(3, 5, 0)) --> 185 Function TimeToMinutes(ByVal newTime As Date) As Long TimeToMinutes = Hour(newTime) * 60 + Minute(newTime) End Function «/Code» ....Read More
TimeToSeconds - Convert a time value into a number of seconds
Total Hit (818) «Code LangId=1»' Converts a time value to a numeric value in seconds ' Example: ' MsgBox TimeToSeconds(TimeSerial(3, 5, 20)) --> 11120 Function TimeToSeconds(ByVal newTime As Date) As Long TimeToSeconds = Hour(newTime) * 3600 + Minute(newTime) * 60 + Second _ (newTime) ....Read More
TimeToString - Convert time to a descriptive string
Total Hit (1192) «Code LangId=1»' convert a date value into a string in the format ' YY years, MM months, DD days, HH hours, MM minutes, SS.HH seconds) ' you can also opt for time short format (HH h, MM m, SS s) Function TimeToString(ByVal aDate As Date, Optional ShortTimeFormat As Boolean, _ Optional ....Read More
Calculate the Elapsed Time between two Dates...
Total Hit (1377)
How to retrive and change system's short/long date format
Total Hit (4077) This article will demonstrate how to retrive system's local name and short/long date format. It will also show you how to change current short/long date format of the system. To implement Copy/Paste Demo - Create a standard exe project - Add a module - Place 3 labels on the form1 (to diaplay ....Read More

(Page 1 of 2) 31 Result(s) found  1 2

Recommanded Links


Home   |  Comment   |  Contact Us   |  Privacy Policy   |  Terms & Conditions   |  Blogs

© 2008 BinaryWorld LLC. All rights reserved.