I can tell you this: There is no canned function that will make this easy. I always end up writing my own functions.
Just to get you started, I can give you a few hints. I haven’t looked at the example Daniel showed, but I imagine I would do it in a similar way. I’ve found it is useful to use a pointer and index through the data and create the string byte by byte. For instance, let’s say you want to print “TEST 12345”, and the data that you are sending in located in DB200, starting at DBB0. And, let’s assume that the string always starts with “TEST “, followed by a number up to five digits (which is represented in MD50). Here is some code that should work. Just create a DB200 and define an array of 100 characters, and put this code in OB1. Then, force MD50 with any number between 0 and 99999, and you will see that the text will change from “TEST 0” to “TEST 99999”.
Once you understand how this works, you’ll see how you can create any string using dynamic numbers (such as your time stamp). By the away, don’t bother thinking in terms of “strings” in the S7 side for this application. Think in terms of characters instead (the difference will be evident when you start programming this stuff). Also, even though I am not using the Date and Time specifically, this method works with any dynamic data, no matter where it comes from. If you do a search of the recent threads, you will see some other questions regarding the Siemens Date Time format.
//**************************
//Convert the DINT to BCD and
//transfer it to MD100
//**************************
L MD 50
DTB
T MD 100
//**************************
//Open DB200 and initialize
// area pointer 1
//**************************
OPN DB 200
L 0
LAR1
//**************************
//Load "TEST " as static data to the
//first five bytes of DB200.
//**************************
L 'TEST'
T DBD [AR1,P#0.0]
L ' '
T DBB [AR1,P#4.0]
+AR1 P#5.0
//**************************
//Clear the bytes that represent the DINT
//by transferring spaces.
//**************************
L ' '
T DBD [AR1,P#0.0]
L ' '
T DBB [AR1,P#4.0]
//**************************
//Check to see how many digits are
//in the DINT
//**************************
L MD 50
L L#9999
>D
JC m001
L MD 50
L L#999
>D
JC m002
L MD 50
L L#99
>D
JC m003
L MD 50
L L#9
>D
JC m004
JU m005
//**************************
//Take the DINT in BCD form, and isolate the
//first digit by shifting it left 12 bits,
//and then move it to the right 28 bits.
//Add 48 to each digit to convert it to
//ASCII. Repeat this for each digit.
//**************************
m001: L MD 100
SLD 12
SRD 28
+ 48
T DBB [AR1,P#0.0]
+AR1 P#1.0
m002: L MD 100
SLD 16
SRD 28
+ 48
T DBB [AR1,P#0.0]
+AR1 P#1.0
m003: L MD 100
SLD 20
SRD 28
+ 48
T DBB [AR1,P#0.0]
+AR1 P#1.0
m004: L MD 100
SLD 24
SRD 28
+ 48
T DBB [AR1,P#0.0]
+AR1 P#1.0
m005: L MD 100
SLD 28
SRD 28
+ 48
T DBB [AR1,P#0.0]
+AR1 P#1.0