Thread Rating:
  • 442 Vote(s) - 2.86 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Setting a value to DateField by keyboard
09-27-2011, 07:49 PM, (This post was last modified: 09-27-2011, 07:50 PM by alchimiste.)
#3
RE: Setting a value to DateField by keyboard
Thanks a lot..

I implement what users want with your help.

The modified code as below:
PHP Code:
{DateField
    value 
= {DateTime.date},
    
parse-spec={proc {value:String, require-four-digit-year?:booldf:DateField }:(date:DateTimeday-start-pos:intday-end-pos:intmonth-start-pos:intmonth-end-pos:intyear-start-pos:intyear-end-pos:int)
                   
def buf = {StringBuf value}
                   {if {
buf.find-string "/"} > -or {buf.find-string "-"} > -1 then
                       
{if buf.size != 10 then
                           
{return {DateTime}, 895603}
                       }
                       
def str = {buf.to-String}
                       
def d = {DateTime year={{str.substr 04}.to-int}, month={{str.substr 52}.to-int}, day={{str.substr 82}.to-int}}
                       {return 
d895603}
                       
                    else
                       {if 
buf.size != 8 then
                           
{return {DateTime}, 674603}
                       }
                       
def str = {buf.to-String}
                       
def d = {DateTime year={{str.substr 04}.to-int}, month={{str.substr 42}.to-int}, day={{str.substr 62}.to-int}}
                       {return 
d674603}
                   }
               },
    
    
format-spec =
        {
proc {dt:DateTimedf:DateField}:String
            
{return
                
                {
format "%4d%02d%02d"
                    
dt.info.yeardt.info.monthdt.info.day
                
}
            }
        }



Messages In This Thread
RE: Setting a value to DateField by keyboard - by alchimiste - 09-27-2011, 07:49 PM

Possibly Related Threads...
Thread Author Replies Views Last Post
  DateField の ValueFinished の抑制 umemura 1 2,597 01-24-2013, 08:10 PM
Last Post: umemura
Forum Jump:


Users browsing this thread:
1 Guest(s)

MyBB SQL Error

MyBB has experienced an internal SQL error and cannot continue.

SQL Error:
1017 - Can't find file: 'mybb_threadviews' (errno: 2)
Query:
INSERT INTO mybb_threadviews (tid) VALUES('286')