Populate date field (with converting it)

Hi
I have a date field in Jalali (= persian, farsi, shamsi) format.
It works fine.
I have an another date field and want to populate it’s value based on that Jalali date field in Gregorian format.

I try this snippet (How to Populate and Modify Dates and Times with Gravity Forms - Gravity Wiz) for populating second date value based of first and it works well.

But
It can not convert the date, Just copy the first one and paste it in second one.

You can convert the date format with that snippet. Take a look at this example from their page:

new GW_Populate_Date( array(
	'form_id'         => 39,
	'target_field_id' => 7,
	'modifier'        => '+1 year',
	'format'          => 'F j, Y' // i.e. March 10, 2015
) );

The format parameter is the one you need to modify:

I saw and try it. But changing the format just change the YYYY/MM/DD to for example MM-DD-YY and not it’s calendar.

You want to change to a completely different calendar, rather than the Gregorian Calendar? I do not believe that is possible with that snippet. I don’t know of a solution for that issue. I will leave this open in case someone else has an idea on how to accomplish that. Thank you.

exactly. I want to convert it to Jalali (persian) calendar.

My current field take date from user in Jalali calendar and I want to have another field that save that date in gregorian calendar automatically.

Thank you Chris.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.