Need to transform a date from DD-MM-YYYY to YYYYMMDD

Hello everybody,

I need to transform a date type data captured as dd-mm-yyyy or dd-mm-yy to a number data with the format yyyymmdd, that is to say, today we capture from the document the date 09-01-14 and I would like to get another data automatically that is 20140109, in order to use this last data to name the document.

Could anybody tell me how to do it? thanks in advanced



  • Avatar

    you would either have to capture the month day and year separately and merge them together in the order you want using the rule built into flexiCapture 10 or write a script. See attached image of sample script. For some reason IE10 doesn't let me copy and paste the script into this forum's text box.

    You still need to normalize the year using another script but this script should work for 4 digit years.
  • Avatar
    Thanks, Sushi,

    I must use a script because the date is extracted from different reports not normalized so it is quiet difficult to take it seperately.

    In the script, I have a doubt, you set the value of a field called "CDate" with the splitted date, what is "Cdate" used for and how do you use it?

    Thanks, again
  • Avatar
    Feri Santosa
    Hi Robsan,

    if the format of the data is date, you could use some function in microsoft Operating System.

    In this case, I am using VisualBasic.Net

    Dim mydatedata as date
    Dim myday, mymonth, myyear as string

    myday =
    mymonth = microsoft.visualbasic.month(mydatedata).tostring
    myyear = microsoft.visualbasic.year(mydatedata).tostring

    if myday < 10="">
    myday = "0" & myday
    end if

    if mymonth < 10="">
    mymonth = "0" & mymonth
    end if

    Dim documentname as string = myyear & mymonth & myday

    Hope this could be helpful.

  • Avatar
    If it is possible to use 3 fields for the date, some or all of the script below may be helpful.

    In our case we capture;
    2 digits for Month (MM)
    2 digits for day (DD)
    2 digits for yead (YY)

    Our final output is MM/DD/YYYY

    But we also use a "DateINT" of YYYYMMDD

    'If no date then enter Now
    If (me.Field("MM").Text = "") THEN me.Field("MM").Text = Month(Date())
    If (me.Field("DD").Text = "") THEN me.Field("DD").Text = Day(Date())
    If (me.Field("YY").Text = "") THEN me.Field("YY").Text = Year(Date())

    'Strip blank spaces
    me.Field("MM").Text = Replace(me.Field("MM").Text," ","")
    me.Field("DD").Text = Replace(me.Field("DD").Text," ","")
    me.Field("YY").Text = Replace(me.Field("YY").Text," ","")

    'Set [MM], [DD], [YY]
    If Len(me.Field("MM").Text) = 1 then me.Field("MM").Text = "0" + me.Field("MM").Text
    If Len(me.Field("DD").Text) = 1 then me.Field("DD").Text = "0" + me.Field("DD").Text
    If Len(me.Field("YY").Text) = 2 then me.Field("YY").Text = "20" + me.Field("YY").Text

    'Merge Date
    me.Field("Date").Text = me.Field("MM").Text + "/" + me.Field("DD").Text + "/" + Me.Field("YY").Text

    me.Field("DateINT").Text = me.Field("YY").Text + me.Field("MM").Text + me.Field("DD").Text

Please sign in to leave a comment.