Options

CoNVERT date to text or code

karuchuakaruchua Member Posts: 151
hello all,

is it possible to achieve either of the above?
convert date to code or text.

Answers

  • Options
    Gurn37Gurn37 Member Posts: 1
    Hi,

    Use the FORMAT function.

    Regards
    G.
  • Options
    karuchuakaruchua Member Posts: 151
    i have it but giving me a funny output,not the date
  • Options
    Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Describe "funny output"
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • Options
    karuchuakaruchua Member Posts: 151
    this is the date 12/03/12 i want to convert to code but this is what i get 41246
  • Options
    Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    And how does your code looks like?
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • Options
    karuchuakaruchua Member Posts: 151
    Row:=Row+1;
    [b]EnterCell(Row,1,FORMAT("Order Date"),FALSE,FALSE,FALSE);[/b]
    EnterCell(Row,2,"No.",FALSE,FALSE,FALSE);
    EnterCell(Row,3,"Sell-to Customer No.",FALSE,FALSE,FALSE);
    EnterCell(Row,4,"Sell-to Country/Region Code",FALSE,FALSE,FALSE);
    EnterCell(Row,5,FORMAT(Amount),FALSE,FALSE,FALSE);
    EnterCell(Row,6,FORMAT("Customs Entry No"),FALSE,FALSE,FALSE);
    EnterCell(Row,7,FORMAT("Exit Doc Received?"),FALSE,FALSE,FALSE);
    
  • Options
    Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Try
    txtOrderDate := FORMAT("Order Date");
    MESSAGE(txtOrderDate);
    
    to see the date is converted to text correctly. It's possibly Excel that displays them different ... which was not mentioned in your original question. You need to place a ' character before your order date, so it's treated as text by Excel.
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
  • Options
    karuchuakaruchua Member Posts: 151
    @Luc Van Dyck,thxs and sorry for not clarifying about the excel, yes it formats on message,what do you mean by placing a character before the order date.
  • Options
    SavatageSavatage Member Posts: 7,142
    by putting a ' to start your field excel will look at is as text and not a formula.

    See here:
    viewtopic.php?f=23&t=24043
  • Options
    karuchuakaruchua Member Posts: 151
    @savatage and @Luc Van Dyck,thxs man,it worked.

    i added ''''+format(orderdate) and it good now.
  • Options
    Luc_VanDyckLuc_VanDyck Member, Moderator, Administrator Posts: 3,633
    Please mark your topic as solved. See forum rules #3.9
    No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)
Sign In or Register to comment.