TGC Codebase Backup



D2N by Vidiot

12th Mar 2007 18:26
Summary

Converts string date to number. Format: mm/dd/yy



Description

This function converts a string date as might be supplied by the Get Date$() function into a numerical value so you can perform simple logic: >, <, or = on dats. For simplicity sake, it assumes each month has 32 days. Therefore doing addition or subtraction of these numbers with the intention of converting the result back to a date or number of days would yield false results.



Code
                                    ` This code was downloaded from The Game Creators
                                    ` It is reproduced here with full permission
                                    ` http://www.thegamecreators.com
                                    
                                    Function d2n(d$ as string)
   M#=val(mid$(d$,1)+mid$(d$,2))
   D#=val(mid$(d$,4)+mid$(d$,5))
   Y#=val(mid$(d$,7)+mid$(d$,8))
   V# = Y# + (M#/12) + (D#/(384))
EndFunction V#