DateTimeStamp - can I set vDB to automate my DTStamp?
Barry G. Sumpter
barrysum at bigpond.net.au
Sat Mar 24 18:39:04 CDT 2012
I don't want to have to figure out how to format a string to get the a
DateTimeStamp to save as a DateTime field on my record.
Is there a way to automate Valentina to do the DateTimeStamp work for me?
...
get VTable_CreateVarcharField( pTable, "DateTimeStamp", 20, "fIndexed" )
get VTable_CreateDateTimeField( pTable, "DnT", "fIndexed" )
...
get VDatabase_DateFormat( mDBRef, "kYMD" ) --Set the Date format to
yyyymmdd
get VDatabase_DateSep( mDBRef, "-" ) --Set the Date Seperator format to
yyyymmdd
get VDatabase_TimeSep( mDBRef, ":" ) --Set the Time Seperator formt to
yyyymmdd
...
put VTable_Field( mUser, "DateTimeStamp" ) into mDateTimeStamp
put VTable_Field( mUser, "DnT" ) into mDnT
...
put the internet date into myInternetDate
convert myInternetDate to dateItems
-- dateItems: yyyy,MM,dd,hh,mm,ss,d
-- 1 * the year
-- 2 * the month number
-- 3 * the day of the month
-- 4 * the hour in 24-hour format
-- 5 * the minute
-- 6 * the second
-- 7 * the numeric day of the week where Sunday is day 1, Monday is day
2, and so forth
Repeat with i = 1 to 6
if the length of item i of myInternetDate < 2 then
put "0" & item i of myInternetDate into item i of myInternetDate
end if
end Repeat
put item 1 of myInternetDate into myYear
put item 2 of myInternetDate into myMonth
put item 3 of myInternetDate into myDay
put item 4 of myInternetDate into myHour -- 24 hour format
put item 5 of myInternetDate into myMinute
put item 6 of myInternetDate into mySecond
get VField_Value( mDateTimeStamp, myYear & date_separator & myMonth &
date_separator & myDay && myHour & time_separator & myMinute &
time_separator & mySecond ) -- Works cause mDateTimeStamp is just
VarCharField
get VField_Value( mDnT, myYear & date_separator & myMonth & date_separator &
myDay && myHour & time_separator & myMinute & time_separator & mySecond )
-- Doesn't work cause I don't know how to format the value for a
DateTimeField
Is there a way to automate Valentina to do the DateTimeStamp work for me?
tia
More information about the Valentina
mailing list