• 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!

TOPIC: Get weekday from date

Get weekday from date 8 years 3 months ago #36373

  • info2972
  • info2972's Avatar
  • OFFLINE
  • Fresh Boarder
  • Posts: 4
Hello everyone,

im trying to create an appointment form with RSForm pro.
what im trying right now is extracting a weekday (f.e. monday) from a date.
php should be able to do that with the code:
//to get the date from the date field
$string = $_POST['maak-een-apraak']['date'];
 
// to create the correct format
$date = DateTime::createFromFormat("d F Y", $string);      
 
// to get te weekday to show
echo date_format($date, 'l');
where ($date, 'l'); is lowercase 'L' to return the weekday

however i cant get the weekday (l) value to display in the text field. th field remains empty and i keep getting the error message:" Warning: date_format() expects parameter 1 to be DateTimeInterface, null given"

i have tryed to put the code in the default value box insite the form component and to put the code into the code <> section in th ebackend of the form. but i cant't get it to work.

is anyone able to help me with this issue?
thanks!
The administrator has disabled public write access.
  • 1

Read this first!

We do not monitor these forums. The forum is provided to exchange information and experience with other users ONLY. Forum responses are not guaranteed.

However, please submit a ticket if you have an active subscription and wish to receive support. Our ticketing system is the only way of getting in touch with RSJoomla! and receiving the official RSJoomla! Customer Support.

For more information, the Support Policy is located here.

Thank you!