anonymouse703's avatar

Why creted_at is not formatted when export in server?

I have this transaction exporter,

why do created_at on my transactions export is not formatted just like in my local July 8, 2025 1:22 PM

this is in the staging

2025-07-08 04:31:10

but the user export was ok

User Export

Transaction Export

0 likes
4 replies
AddWebContribution's avatar

You can try this instead

ExportColumn::make('created_at')
    ->label('Created At')
    ->formatStateUsing(fn ($state) =>
        ($state instanceof \Carbon\Carbon ? $state : \Carbon\Carbon::parse($state))
            ->timezone('Asia/Manila')
            ->format('F, d, Y g:i A')
    ),

Ensure that the app.timezone and config('app.timezone') values are the same across local and staging environments.

Glukinho's avatar

Please share your model classes and table structure.

anonymouse703's avatar
anonymouse703
OP
Best Answer
Level 6

@Glukinho I found the solution I used the. translated_format

ExportColumn::make('created_at')
                    ->label('Created Date')
                    ->formatStateUsing(fn ($state) =>
                        $state?->timezone('Asia/Manila')->translatedFormat('F, d, Y g:i A')
                    ),
1 like

Please or to participate in this conversation.