LAE

Welcome to the LAE community!  Please feel free to start a discussion in the discussion tab or join in a conversation.

Discussions

Members

Resources

Events

 View Only
  • 1.  Date to String function

    Employee
    Posted 12-19-2007 20:19

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: rhallmark3

    Is there a function that will convert a date into a string format? I'm trying to find a function that will show me what day of the week (Mon, Tues, etc.) a particular day is so some logic can be built around that in a graph.

    Any help would be very much appreciated.


  • 2.  RE: Date to String function

    Employee
    Posted 12-21-2007 19:08

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: rboccuzzi

    Here is two ways to do it. One is to just cast the date as a string, and it will convert it for you:
    strField = format("date is %s", dateField)
    or even
    strField = "the date is " + dateField

    The second is to do it yourself:
    strField = format("date is %d/%d/%d", dateField.year(), dateField.month(), dateField.day())

    and of course, you could use %02d to pad with 0's, for example, if you are doing it the second way.<br><br>Post edited by: rboccuzzi, at: 2007/12/21 20:09


  • 3.  RE: Date to String function

    Employee
    Posted 12-21-2007 19:31

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: robby123

    All I am getting is "date is 2007/12/21". I think the intent was to bring back something more like "Today is Fri" based on date.


  • 4.  RE: Date to String function

    Employee
    Posted 01-04-2008 17:48

    Note: This was originally posted by an inactive account. Content was preserved by moving under an admin account.

    Originally posted by: robby123

    I figured it out... Since you guys didn't

    mydate = date()
    test = mod( dateSubtract(mydate,date(1900, 1, 6)), 7)
    if (test == 1) then
    {stringday = "Sunday"}
    if (test == 2) then
    {stringday = "Monday"}
    if (test == 3) then
    {stringday = "Tuesday"}
    if (test == 4) then
    {stringday = "Wednesday"}
    if (test == 5) then
    {stringday = "Thursday"}
    if (test == 6) then
    {stringday = "Friday"}
    if (test == 7) then
    {stringday = "Saturday"}

    emit mydate, stringday