<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
font-size:11.0pt;
font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
span.EmailStyle21
{mso-style-type:personal-compose;
font-family:"Calibri",sans-serif;
color:windowtext;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=DE link=blue vlink=purple style='word-wrap:break-word'><div class=WordSection1><p class=MsoNormal><span style='mso-fareast-language:EN-US'>Hi Ben,<o:p></o:p></span></p><p class=MsoNormal><span style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>thanks for comments and ideas. I was also thinking about something along the lines.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>There is a somewhat similar discussion on the opensips github on extending $time functionality but unfortunately it did not progress since 2014:<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'><a href="https://github.com/OpenSIPS/opensips/issues/378#issuecomment-61608369">https://github.com/OpenSIPS/opensips/issues/378#issuecomment-61608369</a><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'> Thanks,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'>Xaled<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US style='mso-fareast-language:EN-US'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span lang=EN-US>From:</span></b><span lang=EN-US> Users <users-bounces@lists.opensips.org> <b>On Behalf Of </b>Ben Newlin<br><b>Sent:</b> Tuesday, February 23, 2021 2:25 AM<br><b>To:</b> OpenSIPS users mailling list <users@lists.opensips.org><br><b>Subject:</b> Re: [OpenSIPS-Users] Timestamp in date format<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span lang=EN-US>That function only uses the current time. As far as I know there are no generic time string format functions in OpenSIPS. The only options are to manipulate the current time only.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US>You could use exec or one of the language modules like python to do this. Or you could write to the XML as a timestamp and convert it outside of OpenSIPS. The latter would be my recommendation if possible.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><p class=MsoNormal><span lang=EN-US style='color:black'>Ben Newlin </span><span lang=EN-US><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><o:p> </o:p></span></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal style='margin-bottom:12.0pt'><b><span lang=EN-US style='font-size:12.0pt;color:black'>From: </span></b><span lang=EN-US style='font-size:12.0pt;color:black'>Users <<a href="mailto:users-bounces@lists.opensips.org">users-bounces@lists.opensips.org</a>> on behalf of <a href="mailto:xaled@web.de">xaled@web.de</a> <<a href="mailto:xaled@web.de">xaled@web.de</a>><br><b>Date: </b>Monday, February 22, 2021 at 5:25 PM<br><b>To: </b>'OpenSIPS users mailling list' <<a href="mailto:users@lists.opensips.org">users@lists.opensips.org</a>><br><b>Subject: </b>Re: [OpenSIPS-Users] Timestamp in date format<o:p></o:p></span></p></div><p class=MsoNormal><span lang=EN-US>Hi Ben,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>found that as well, thank you.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Is there a way to add for example a week to the current datetime to have a datetime that can be used to say that something is valid until one week in the future? <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>If 2013-08-01T12:00:00Z is now then to have 2013-08-08T12:00:00Z<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Thanks,<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>Xaled<o:p></o:p></span></p><div><div style='border:none;border-top:solid #E1E1E1 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span lang=EN-US>From:</span></b><span lang=EN-US> Users <<a href="mailto:users-bounces@lists.opensips.org">users-bounces@lists.opensips.org</a>> <b>On Behalf Of </b>Ben Newlin<br><b>Sent:</b> Monday, February 22, 2021 10:09 PM<br><b>To:</b> OpenSIPS users mailling list <<a href="mailto:users@lists.opensips.org">users@lists.opensips.org</a>><br><b>Subject:</b> Re: [OpenSIPS-Users] Timestamp in date format<o:p></o:p></span></p></div></div><p class=MsoNormal><span lang=EN-US> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>> I know that there is a get_timestamp function but I need the result to be formatted as date.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>You can use the $time variable.<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US><a href="https://www.opensips.org/Documentation/Script-CoreVar-3-1#toc93">https://www.opensips.org/Documentation/Script-CoreVar-3-1#toc93</a><o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US>$time("%Y-%m-%dT%TZ")<o:p></o:p></span></p><p class=MsoNormal><span lang=EN-US> <o:p></o:p></span></p><div><p class=MsoNormal><span lang=EN-US style='color:black'>Ben Newlin </span><span lang=EN-US><o:p></o:p></span></p></div><p class=MsoNormal><span lang=EN-US> <o:p></o:p></span></p><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal style='margin-bottom:12.0pt'><b><span lang=EN-US style='font-size:12.0pt;color:black'>From: </span></b><span lang=EN-US style='font-size:12.0pt;color:black'>Users <<a href="mailto:users-bounces@lists.opensips.org">users-bounces@lists.opensips.org</a>> on behalf of <a href="mailto:xaled@web.de">xaled@web.de</a> <<a href="mailto:xaled@web.de">xaled@web.de</a>><br><b>Date: </b>Monday, February 22, 2021 at 4:01 PM<br><b>To: </b>'OpenSIPS users mailling list' <<a href="mailto:users@lists.opensips.org">users@lists.opensips.org</a>><br><b>Subject: </b>[OpenSIPS-Users] Timestamp in date format</span><span lang=EN-US><o:p></o:p></span></p></div><div><p class=MsoNormal style='margin-bottom:12.0pt'><span lang=EN-US>Hi,<br><br>I need to create a timestamp node in an XML body like shown below<br><br><timestamp>2013-08-01T12:00:00Z</timestamp><br><br>I know that there is a get_timestamp function but I need the result to be formatted as date.<br><br>BTW, is there a way to directly define XML item value using variable<br><br>Something like: <br>$xml(my_doc/doc/list) = "<item>$var(value)</item>";<br><br>Unfortunately it does not work like this<br><br>Thanks,<br>Xaled<br><br><br>_______________________________________________<br>Users mailing list<br><a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br><a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><o:p></o:p></span></p></div></div></body></html>