Atlanta Custom Software Development 

 
   Search        Code/Page
 

User Login
Email

Password

 

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

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

 

An enhanced VB DatePart function
Total Hit (4692) 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.
Rating
Benchmarks with millisecond accuracy
Total Hit (3883) 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:
Rating
Beware of slashes when formatting dates
Total Hit (2945) 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
Rating
Create a system timer using AddressOf and a callback function
Total Hit (4106) 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
Rating
Evaluate the number of days remaining in the current year
Total Hit (2935) 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
Rating
High-precision timing with the QueryPerformanceCounter API function
Total Hit (4891) 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
Rating
Retrieve Time Zone information
Total Hit (7157) 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
Rating
Test for Leap Year
Total Hit (3305) 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
Rating
The age of a person
Total Hit (2852) 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
Rating
The beginning or end of previous week
Total Hit (3813) For reporting, many times you need to figure out what date last week began and ended. Use the code below to figure that out:
Rating
The number of days in a month
Total Hit (3868) 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
Rating
Tricks with DateSerial
Total Hit (3228) 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
Rating
Use Sleep API to add pauses to your programs
Total Hit (4043) 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
Rating
BusinessDateAdd - Add or subtract a number of business days from a date
Total Hit (2923) «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
Rating
BusinessDateDiff - Evaluate the number of business days between two dates
Total Hit (3069) «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
Rating
EasterDate - Evaluate the date of Easter for a given year
Total Hit (2952) «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
Rating
FormatDateTimeEx - Extended formatting for date and time values
Total Hit (3039) «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
Rating
FormatInternationalDate - Retrieving a date in an international format
Total Hit (3503) «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
Rating
GetDBDate - Formatting a date as a DateSerial for Access
Total Hit (2903) «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
Rating
GetRoshHashanah - Get the date of Rosh Hashanah (Jewish calendar)
Total Hit (2900) «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
Rating
IsValidDateField - Check whether a date is valid
Total Hit (3455) «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
Rating
Monday - retrieving the date of the Monday for a specified week
Total Hit (2793) «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
Rating
PerformanceTimer - A class module for high-resolution time measurement
Total Hit (3620) «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
Rating
SecondsToString - Convert a number of seconds into a formatted time string
Total Hit (2816) «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
Rating
SecondsToTime - Convert a number of seconds to a Date value
Total Hit (2919) «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
Rating
TimeToMinutes - Convert a time value into a number of minutes
Total Hit (2740) «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
Rating
TimeToSeconds - Convert a time value into a number of seconds
Total Hit (3760) «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
Rating
TimeToString - Convert time to a descriptive string
Total Hit (3869) «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
Rating
Calculate the Elapsed Time between two Dates...
Total Hit (3613)
Rating
How to retrive and change system's short/long date format
Total Hit (7950) 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
Rating


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

Recommanded Links

 

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

© 2008 BinaryWorld LLC. All rights reserved.