Jump to content

Converting Text to Date

This topic is 1864 days old. Please don't post here. Open a new topic instead.

Recommended Posts

I am trying to convert text to date using GetAsDate function

I referred to an old answer on below link: But I couldn't get it working , my system's date format is 2016-01-05 and I used the syntax: 

GetAsDate ( Right ( date_start_printing_text;4 ) & "-" & Left ( date_start_printing_text;3 )  &  "-" &  Middle ( date_start_printing_text ; 5 ; 2 ) ) to convert the value format 01-05-2016 

date_start_printing_text is a calculation field, returns text value,  which calculates its value from a text field with timestamp value using Left function

Left ( timestamp_printing ; Position ( timestamp_printing ; " " ; 1 ; 1 )) 


Edited by dav1089
Link to comment
Share on other sites

Well, if you look at the string you are trying to convert to date  - i.e. the result of =

Right ( date_start_printing_text;4 ) & "-" & Left ( date_start_printing_text;3 )  &  "-" &  Middle ( date_start_printing_text ; 5 ; 2 )

you will see that when the input is "01-05-2016" the output is "2016-01--5-" - so that's not going to work.

I would also suggest you use the Date() function instead of GetAsDate() - that way the calculation does not depend on the date format being used by your file. Try =

Date (
Left ( date_start_printing_text ; 2 ) ;
Middle ( date_start_printing_text ; 4 ; 2 ) ;
Right ( date_start_printing_text ; 4 )


P.S. Why do you need the date_start_printing_text field? You could extract the date components directly from the original timestamp string.


Edited by comment
  • Like 1
Link to comment
Share on other sites

This topic is 1864 days old. Please don't post here. Open a new topic instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Similar Content

    • By Mafia2020
      I have a calculation that goes like that, I input a number on "Base Imponibile" (say 100), it adds 15% (it gets me 115), it then calculates 4% to the previous result (115) and it gets me 4,60, I then add 2 and the total is 121,60 which is perfect.
      And that's the part that works just fine. But I then want to make a reverse calculation, where I input the expected result of Total Calculation and tells me all the other values and here it's where things go awry.
      I'm attaching the initial calculation that works as a reference and the reverse calculation which doesn't work as an example. The "2" that gets subtracted in the reverse calculation is a fixed value of a small tax that I have to deduct (imposta di bollo).
      I have a feeling that the reverse calculation goes crazy because of some unwanted rounding somewhere, but I am not to sure, so I seek the opinion of more calculation versed persons around.

    • By Guy_Smith
      This should be easy, but my brain just won't cooperate!
      I'm moving a bunch of stuff and want to inventory what is in each moving container.  I have a very simple parent-child relationship with the parent record having the container number and category of parts/equipment/supplies and the child records describe each piece of equipment in the container.  I have a portal with the child records showing for each container, but want to put anatto-entered item number for each piece that has the container number followed by a dash and then followed by a serialized number for each item in that particular container.  For example, I would have container 1 labeled "Glassware" and Container 2 labeled "Chemicals".  In Container 1's portal I'd like to see:
      Item    Description          Qty
      1-1      Beakers, 500ml    4
      1-2      Beakers, 250 ml   2
      and in Container 2's portal I'd like to see:
      Item    Description          Qty
      2-1      Potassium           4 g
      2-2      Sodium                26 g
      I'd like to auto-fill the item numbers, but can't figure out how to reset the serialization for each parent record.
      Any help is greatly appreciated.
      Thanks and keep yourselves safe!
    • By Rich
      Greets, all:
      I'm using this calculation--in a parent table in a field temporarily named 'Temp'--to grab course numbers from the course_number field in a related/child table:
      UniqueValues ( List ( ASSIGNMENT_COURSE::Course_Number__lxt ) )
      (I'm using this calc because the child table contains multiple records with the same course number; it's not a key field.)
      My intent is to use six buttons--in the parent table--where each button would grab an assigned row's value using the calculation above. For example, say that the above calc has this result:
      I want Button 1 to grab AST-100; Button 2 to grab EDU-100; Button 3 to grab EDU-300, etc.
      Mind you, I can't make a value list out of Temp because it can't be indexed.
      TIA for your help! 
    • By Asu
      I know. Don't use them. But There is a simple task and a repeating field would be a quick solution.
      Field 1: a number
      Field 2: a calculated repeating field, each repetition adds the repetition number to the value of Field 1.
      Can it be done?
    • By stan111
      Gents, need your help on the following issue:
      I need to track my expanses. There are 4 tables: Products, PriceChanges, Transactions.
      The problem: I need to make a script which will make calculations in transactions tab, accounting for the latest price change.
      01 jan17 I bought one bottle of wine for $1 
      03 jan 17 I bought the same bottle of wine for $1,5. So the latest price is $1.5
      In Products table there is one record which is wine. 
      In PriceChanges table there are two records: $1 and $1.5
      I need that Transactions table automatically take corresponding wine prices while adding new or past records.
  • Who Viewed the Topic

    1 member has viewed this topic:
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.